PHP Exercises: Create a new array from a given array of integers shifting all zeros to left direction
Write a PHP program to create a new array from a given array of integers shifting all zeros to left direction.
Sample Solution:
PHP Code :
Sample Output:
New array: 0,0,1,3,5,7,2,9,11
Flowchart:
PHP Code Editor:
Contribute your code and comments through Disqus.
Previous: Write a PHP program to create a new array taking the elements after the element value 5 from a given array of integers.
Next: Write a PHP program to create a new array after replacing all the values 5 with 0 shifting all zeros to right direction.
What is the difficulty level of this exercise?
Test your Programming skills with w3resource's quiz.
- Weekly Trends and Language Statistics
- Weekly Trends and Language Statistics