《PHP編程:php字符串替換函數(shù)substr_replace()用法實例》要點:
本文介紹了PHP編程:php字符串替換函數(shù)substr_replace()用法實例,希望對您有用。如果有疑問,可以聯(lián)系我們。
本文實例講述了php字符串替換函數(shù)substr_replace()用法.分享給大家供大家參考.具體分析如下:PHP實例
substr_replace用于在指定字符串中替換指定位置的子字符串PHP實例
<?php $string = "Warning: System will shutdown in NN minutes!"; $pos = strpos($string, "NN"); print(substr_replace($string, "15", $pos, 2)."\n"); sleep(10*60); print(substr_replace($string, "5", $pos, 2)."\n"); ?>
上面代碼輸入如下結(jié)果PHP實例
Warning: System will shutdown in 15 minutes! (10 minutes later) Warning: System will shutdown in 5 minutes!
希望本文所述對大家的php程序設(shè)計有所贊助.PHP實例
《PHP編程:php字符串替換函數(shù)substr_replace()用法實例》是否對您有啟發(fā),歡迎查看更多與《PHP編程:php字符串替換函數(shù)substr_replace()用法實例》相關(guān)教程,學(xué)精學(xué)透。維易PHP學(xué)院為您提供精彩教程。
轉(zhuǎn)載請注明本頁網(wǎng)址:
http://www.fzlkiss.com/jiaocheng/11688.html