InterviewSolution
Saved Bookmarks
| 1. |
How to use array_pop() and array_push() in PHP? |
|
Answer» 1. array_pop() It is used to delete or remove the last element of an ARRAY. Example$a=array("BLUE","black","skyblue"); OUTPUT : Array ( [0] => blue[1] => black) 2. array_push()It is used to Insert one or more ELEMENTS to the end of an array. Example$a=array("apple","BANANA"); array_push($a,"mango","pineapple"); OUTPUT : Array ( [0] => apple[1] => banana[2] => mango[3] => pineapple) Also Read: PHP Strings |
|