Jump to content

New to PHP - strange looking array


zander1983

Recommended Posts

Hi

I'm a student and new to PHP. I was recently provided with a question which had a funny looking array. My question is, are the '1', 'Phrase', 'e_3', 'key', '15', '9' and 'comment' the keys to the array? As in will print(array['1']) output 'apple' and print(array['e_3']) output 'carrot'? The question is below:

 

Given the following array, remove the letter ‘t’ from every second element and display the contents of the array.

$data = array( '1' => 'apple',

'phrase' => 'better',

'e_3' => 'carrot',

'key' => 'rabbit',

'15' => 'dog',

'9' => 'flute',

'comment' => 'elephant'

);

Link to comment
https://forums.phpfreaks.com/topic/199205-new-to-php-strange-looking-array/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.