PHP how to truncate an array
70
How do you truncate a PHP array in a most effective way?
Should I use array_splice?
How do you truncate a PHP array in a most effective way?
Should I use array_splice?
People are also looking for solutions to the problem: php - Group multidimensional array
Our community is visited by hundreds of web development professionals every day. Ask your question and get a quick answer for free.
Do you know the answer to this question? Write a quick response to it. With your help, we will make our community stronger.
Find the answer in similar questions on our website.
Answer
Solution:
You can use the native functions to remove array elements:
With this knowledge make your own function
Demo - http://codepad.viper-7.com/JVAs0aAnswer
Solution:
Yes, unless you want to loop over the array and unset() the unwanted elements.
Answer
Solution:
This function should work
Answer
Solution:
You can use one of this functions:
Usage: