...

View Full Version : why i could not print out the 2 elements from the array



kamkam
11-12-2011, 04:43 AM
Hi;
why i could not print out the 2 elements from the array of the final, it just print out the "Array"
Could anyone help, thanks


<?php
$string="talking animails and get rid off talking about this facebook";
$term="talking a";
preg_match_all("/talking a[a-zA-Z]*/", $string,$final);
$i=0;
while($i<2){
echo $final[$i];
$i++;
}
?>

MattF
11-12-2011, 04:51 AM
If you properly examine the code which you have based that upon, you will see exactly where your problem is.

kamkam
11-12-2011, 05:23 AM
Sorry, i could not find out where my problem is

kamkam
11-12-2011, 05:59 AM
Thanks, i will convert it into one dimension array

MattF
11-12-2011, 06:04 AM
No need.



foreach ($final[0] as $val)
{
echo $val;
}



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum