patriciob00 / questionArrayPHP

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Question

PHP Web Developer Application Sept / Oct 2015

Please complete the application form to apply for the PHP Web Developer role, including uploading your answer to the task below.

Task
Here's an example PHP array:

$foods = array(

  'meat' => array('burgers', 'steak', 'sausages', 'kebabs'),

  'cake' => array('victorian', 'chocolate', 'fruit', 'fudge'),

);

 

We'd like you to create a function that takes an array of this kind as an argument, and then return an array of just the meat values, in reverse alphabetical order.

The array could contain any number of elements and in any order, but there will always be a food array called 'meat' like the one above.

We're not too keen on kebabs in the meat array though, so be sure not to include that in the returned array.

If we passed in the above array into the function, the array that is returned would contain: steak, sausages and burgers, in that order.

Use PHP 5.4 notation for the array.

Make sure your file can be executed from the command line: php meats.php (this helps us to check if the code works before even looking at it)

About


Languages

Language:PHP 100.0%