I have the following array. It contains nicknames and names:
$nickAndNames = array(
array( "Johnie", "John Larson" ),
array ("Maggie", "Margaret London" ),
array("Nic","Nicholas Carradine")
);
Can you please help me to print just the first elements? I mean Johnie, Maggie, Nic.
Each element of the array is another array. Each element of this inner array in turn contains 2 elements: element 0 (a string, the nickname) and element 1 (another string, the name). Therefore, you’d first need to loop through the
$nicksAndNamesarray, and then display the inner array’s first element (which is element 0):