0

Hi I understand that this might be easy for you but I have just started some basic studying on php.I would like to ask what is the possible way to get the 2nd index of an array for example: Supposing that we have 2 arrays:

  //simple logic
  array(2) [name, gender];
  array(3)[id, name, age];

Is there any possible way to target the index 'name' but only from the second array ?

1
  • Do you mean to print name from second array? Commented Mar 7, 2014 at 1:15

1 Answer 1

1

Simple example on how to separate arrays.

<?php
$array1['name'] = "John";
$array1['age'] = "24";

$array2['name'] = "Mike";
$array2['age'] = "26";

/* At this point the array structure is as follows
array1 ('name'=>'John',
        'age'=>'24')

array2 ('name'=>'Mike',
        'age'=>'26')
*/

echo $array1['name']; // prints out John

echo $array2['name']; // prints out Mike
?>
Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.