- Create an array of numbers: 1,2,3,4,5
- Get the sum of all of the numbers combined and put into a variable.
$sum
- Count the number of elements in the array and put into a variable.
$quantity
- Print out 'The sum of the
{quantity}
numbers is:{sum}
'. For example, if the array is [1, 2, 3, 4, 5], the output should be:'The sum of the 5 numbers is: 15'.
- Sort the
$colors
array in ascending order. - Add
'purple'
and'orange'
to the end of the array. - Add
'Red Apple'
to the beginning of the array - Replace the
green
color of the array toGreen mango
.
You should end up with the output of the following array:
Array ( [0] => Red Apple [1] => blue [2] => Green mango [3] => red [4] => yellow [5] => purple [6] => orange )
1 PHP Developer IBM john@ibm.com 09168457456 PHP,MySQL, Javascript
2 Web Designer AWS jane@aws.com 09175597456 PhotoShop,Illustrator, CSS
3 Network Admin CISCO James@cisco.com 09202224575 Database, CyberSecurity, Networking
- Create a multi-dimensional array of associative arrays of 3 job listings shown above.
Also add an array field for skills. The skills array should be an array of strings with each skill a person has example'skills' => ['PHP', 'MySQL', 'JavaScript']
NOTE: note for the name of array varible use this$listings[]
; - Create a new record using the
array_push()
function. The new record should have the same fields as the others.
4 | Graphic Artist | ADOBE | princess@adobe.com | 09208456544 | Photoshop, Bootstrap, Flutter
- Print out the
job_title
,company
andemail
of the second job listing from the array. - Print out the first and third skill of the third job listing in the array.