checking characters?
Posted: Thu Aug 18, 2005 5:38 am
is it possible to check the first four characters of a string? Well to generalise this,Is it possible to check a buch of characters from a string?
A community of PHP developers offering assistance, advice, discussion, and friendship.
http://forums.devnetwork.net/
Code: Select all
$string = "hi hi I'm a string!";
for($i = 0, $j = strlen($string); $i < $j; $i++)
{
if($string{$i} == 'h')
{
$string{$i} = 'H';
}
}
echo $string;Code: Select all
Hi Hi I'm a string!