View Single Post
Old 09-05-2009, 01:37 PM   #1 (permalink)
hello-world
The Contributor
 
hello-world's Avatar
 
Join Date: Feb 2009
Posts: 73
Thanks: 30
hello-world is on a distinguished road
Default Basic Loop with [ str_replace]

I have a problem with replacing and looping.I need your help please to change
This line
Quote:
The quick brown {fox} jumps over the lazy {dog}
To this
Quote:
The quick brown cat jumps over the lazy mouse.
PHP Code:
$string 'The quick brown {fox} jumps over the lazy {dog}';
$arr = array("fox" =>"Cat","dog"=>"mouse");
preg_match_all("/{.*?}/",$testing,$matches); 
By the way how to practice looping in php ?
Is there any good exercise for it ?
hello-world is offline  
Reply With Quote