?php $var = 'ABCDEFGH: / MNRPQR /'; echo "Original: $var hr \n"; / * These two examples replace all of $var with'bob'. * / echo substr_replace($var, 'bob', 0). "br \n"; echo substr_replace($var, 'bob', 0, strlen($var))." br \n"; / * Insert'bob 'right at the beginning of $var. * / echo substr_replace($var, 'bob', 0, 0). "br \n"; / * These next two replace'MNRPQR' in $var with'bob'. * / echo substr_replace($var, 'bob', 10, -1)." br \n"; echo substr_replace($var, 'bob', -7, -1). "br \n"; / * Delete'MNRPQR 'from $var. * / echo substr_replace($var, '', 10, -1)." br \n";?
?php $var = 'ABCDEFGH: / MNRPQR /'; echo "Original: $var hr \n"; / / Remplace toute la cha Ocirc;ne $var par 'bob'. echo substr_replace($var, 'bob', 0). "br \n"; echo substr_replace($var, 'bob', 0, strlen($var))." br \n"; / / Insert 'bob 'au d eacute;but de la cha icirc;ne echo substr_replace($var, 'bob', 0, 0). "br \n"; / / Remplace la s eacute;quence 'MNRPQR' par 'bob'. echo substr_replace($var, 'bob', 10, -1)." br \n"; echo substr_replace($var, 'bob', -7, -1). "br \n"; / / Efface la s eacute;quence 'MNRPQR 'de $var. echo substr_replace($var, '', 10, -1)." br \n";?