hello!! is there any function that can convert every single value of an array into string??? I tried implode() but i think it converts the whole array into one string..maybe i'm wrong..this is what i'm trying to do.. preg_match_all('/<img src\=[\"](.*?)[\"] (.*?)>/si',$x, $y); $count = count($y; for ($i=1;$i<=$count;$i++){ $keys = implode("+",$y[$i]); $new = substr($keys,30,7); } any ideas??
Try list( ): $info = array('coffee', 'brown', 'caffeine'); // Listing all the variables list($drink, $color, $power) = $info; echo "$drink is $color and $power makes it special.\n"; PHP:
Your loop needs to end at ($count-1), not $count. Are you trying to get each array sub-element into its own variable? The way your code works now is that it will put all the sub elements into one variable, $keys.
I want to process every single sub-element of the array. i tried to do it with foreach() but the result is the same..
If you want to process every single image, you do: preg_match_all('/<img src\=[\"](.*?)[\"] (.*?)>/si',$x, $y); foreach($y[1] as $img) { echo $img; } PHP: If you want each image in a string, lets say img_0, img_1,img_2, etc..: foreach($y[1] as $sub => $img) { ${"img_".$sub} = $img; } PHP: If this doesn't help, let me know what exact you are looking to end up with by example.