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

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.