Jump to content

How to print a 2d array not know its size


yanivkalfa

Recommended Posts

well i have an 2d array $arra[][] i dont know its size couse i get this array from preg_match_all i want to make a loop that prints the array some way . i thinks there is a way of doing s with foreach but dont know how .

 

using print_r is not an option couse the resualts of this array are gonna be links or urls for Pics

its sould be something like that :

<?php
$subject = $arr["PicLinks"];
$pattern = '/(http:\/\/[\S]*)/i';
preg_match_all($pattern, $subject, $arra, $PREG_SET_ORDER);
echo '<P><img src="'.$arra[0][0].'" width="421" height="212" />';// this is how its sould be aventualy (only with a loop instead of this actual acho
?>

i have been trying to do :

					foreach($arra as $val)
					{
						foreach($val as $arraa)
						{
						echo '<img src="'.$arraa.'" />';
						}
					}

 

didnt work as i planned. anyways 1 more thing how do i do <P> but not complitly p just to go down 1 raw like \n in echo

i mean i want to have list like this

aasasasa

sasasasa

sasasas

 

and not like this :

sasasasa

 

sasasasa

 

sasasasa

 

sasasas

 

how do i achive this

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.