Monday, October 22, 2012

Array Keys and Array Values

Below is Simple Example which shows how the array keys or array values can be obtained from a array.


<?php

     $personinfo=array(array("name"=>"john","address"=>"pune","age"=>30),
          array("name"=>"Sathya","address"=>"Nashik","age"=>39),
          array("name"=>"madhav","address"=>"pune","age"=>22));

      $arr1=array_keys($personinfo);

      $arr2=array_values($personinfo);

       echo "OUTPUT AS ONLY KEYS FOR GIVEN ARRAY";
       echo "<br><br>";
       print_r($arr1);

      echo "<br><br>";   
      echo "OUTPUT AS ONLY VALUES FOR GIVEN ARRAY";
      echo "<br><br>";
      print_r($arr2);

?>

No comments:

Post a Comment

MS SQL : How to identify fragmentation in your indexes?

Almost all of us know what fragmentation in SQL indexes are and how it can affect the performance. For those who are new Index fragmentation...