當前訪客身份:游客 [ 登錄 | 加入程式開發 討論區 ]
當前訪客身份:未登入或非會員
alumi alumi
131231

Example Basic str_replace() examples

發表於(2014-07-24 06:33:21)  閱讀(643) | 評論(0) 0人收藏此文章,
摘要 Example Basic str_replace() examples


// Provides: 


$bodytag = str_replace("%body%", "black", "

");

// Provides: Hll Wrld f PHP
$vowels = array("a", "e", "i", "o", "u", "A", "E", "I", "O", "U");
$onlyconsonants = str_replace($vowels, "", "Hello World of PHP");

// Provides: You should eat pizza, beer, and ice cream every day
$phrase  = "You should eat fruits, vegetables, and fiber every day.";
$healthy = array("fruits", "vegetables", "fiber");
$yummy   = array("pizza", "beer", "ice cream");

$newphrase = str_replace($healthy, $yummy, $phrase);

// Provides: 2
$str = str_replace("ll", "", "good golly miss molly!", $count);
echo 
$count;
?>

聲明:本站文章版權屬於作者,受法律保護未經作者同意不得轉載。

評論0