0

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;
$ipLite->setKey('c86c104532b5466bda7620b48e20b10ca53ad9070b8cc52b5a5d90a6e57b9bb3');
$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 ?

2
Contributors
5
Replies
6
Views
5 Years
Discussion Span
Last Post by diafol
0

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 ?

1
extract($locations,EXTR_OVERWRITE);
echo $ipAdress;

choose the appropriate flag parameter for extract

0

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

Edited by mohamedasif18: Add more

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.