2011-04-20 36 views
1

簡單的希望,有沒有一種方法,我可以使用strtolower和str_replace在一起。目前,我正在改變變量的價值並單獨聲明它,並且認爲如果我能夠一起做到這一點,它會更有效率嗎?加入strrtplace與strtolower

$afixteam = str_replace(" ","-",$fixData['ateam_name']); 
$afixteamlink = strtolower($afixteam); 

謝謝。

回答

7

這應該這樣做。你可以按照如下方法在方法中運行方法,凝聚成一條線。

$afixteam = strtolower(str_replace(" ","-",$fixData['ateam_name'])); 
+0

謝謝你完美:) – Richard 2011-04-20 12:49:58

+0

非常好。請記住,您可以使用這一切通過PHP來保持你的線數下降,但如果使用太多,你的代碼可能會因可讀性差而受到影響!確保你接受其中一個答案,這只是我們做事的方式;)點擊打勾! – 2011-04-20 12:52:18

+0

該死的。打敗我吧。 – Joshwaa 2011-04-20 14:34:32

2
$afixteam = strtolower(str_replace(" ","-",$fixData['ateam_name'])); 

你將如何與大多數事情。