Hello Everyone ! How to split each array to own variable and display that variable separately . I got code from IP API provider to display user's location,

include 'ip2locationlite.class.php';
$ipLite = new ip2location_lite;
$locations = $ipLite->getCity($_SERVER['REMOTE_ADDR']);
$errors = $ipLite->getError();

echo "<strong>First result</strong><br />\n";
echo count($locations);

echo '<br><br>';
  foreach ($locations as $field => $val) 
	echo $field . ' : ' . $val . "<br />\n";
echo '<br><br>';

Visit This Example

Nw how to seperate each array to each variables ?

Member Avatar

Have a look at extract and list

Hi ardav ! yes i used it, but i dnt know how to ? I need to display $variables without using any loop.. Is there any solutions ?

Member Avatar
echo $ipAdress;

choose the appropriate flag parameter for extract

Hi ardav, Its worked fine, Thank You so so much.. You saved my time... Thank you so much ardav !!:)

Member Avatar

OK, mark as solved.