0

In php I have an array look like this.

Array ( [0] =>
  [1] => Array ([id] => 9 [slot] => 2 [name] => Test Ad [alt] => Test Ad [dimension_width] => 300 [dimension_height] => 400 [clicks] => 1 [start_date] => 06/07/2013 [end_date] => 07/07/2013 [status] => 1 [target] => http://images.google.com [image_url] => http://localhost/WebSites/coffee/wp-content/uploads/2013/06/uwp5-1-151553.jpeg [pre_exp_email] => 0 ) 
  [2] => Array ( [id] => 12 [slot] => 1 [name] => Test Ad [alt] => Test Ad [dimension_width] => 200 [dimension_height] => 300 [clicks] => 0 [start_date] => 06/08/2013 [end_date] => 07/08/2013 [status] => 1 [target] => http://facebook.com [image_url] => http://localhost/WebSites/coffee/wp-content/uploads/2013/06/uwp5-1-1515532.jpeg [pre_exp_email] => 0 )
  [3] => Array ( [id] => 14 [slot] => 1 [name] => Test Ad [alt] => Test Ad [dimension_width] => 200 [dimension_height] => 300 [clicks] => 0 [start_date] => 06/08/2013 [end_date] => 07/08/2013 [status] => 1 [target] => http://facebook.com [image_url] => http://localhost/WebSites/coffee/wp-content/uploads/2013/06/uwp5-1-1515532.jpeg [pre_exp_email] => 0 )
   )

From here I want to get the first value of array. For example I want to get the value of first array

[1] => Array ([id] => 9 [slot] => 2 [name] => Test Ad [alt] => Test Ad [dimension_width] => 300 [dimension_height] => 400 [clicks] => 1 [start_date] => 06/07/2013 [end_date] => 07/07/2013 [status] => 1 [target] => http://images.google.com [image_url] => http://localhost/WebSites/coffee/wp-content/uploads/2013/06/uwp5-1-151553.jpeg [pre_exp_email] => 0 ) 

So can someone kindly tell me how to get the value of 1st array?Any help and suggestions will be really appreciable. Thanks

1 Answer 1

1

say all your array was in a variable $myArray, then

myArray[1]

will give you your first array

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.