How can you filter a PHP array in one of the most effective ways?
What do I use?
You can use basic functions to remove array elements:
- - Shift an element from the beginning of the array
- - Remove a piece of the array
- - Remove an element from the array
Create your own function with this knowledge
function array_truncate (array $ array, $ left, $ correct) {$ Array = array_slice ($ array, $ left, count ($ array) - $ left); $ Array = array_slice ($ array, 0, count ($ array) - $ true); Return $ array; }
Demo -
Comments
Post a Comment