Snippets tagged “unset”
8 snippets use this tag.
- Can't use function return value in write context?PHP
In PHP, this error message typically occurs when a function or method that is expected to return a value is being used in a context where a value cannot be written.
- Efficiency of using foreach loops to clear a PHP array's valuesPHP
Using a foreach loop to clear the values of an array in PHP is an efficient way to do so.
- How do you remove an array element in a foreach loop?PHP
It is generally not recommended to remove array elements while iterating over the array using a foreach loop, because the loop will behave unexpectedly when elements are removed.
- How to Delete an Element from an Array in PHPPHP
In this short tutorial, you will find the most proper solution to the commonly asked question by programmers: how to delete an element from an array.
- How to remove a variable from a PHP session arrayPHP
To remove a variable from a PHP session array, you can use the unset() function.
- How to Remove and Reindex an Array Element in PHPPHP
Sometimes, in the course of working with PHP, it is necessary to remove and reindex an array element. Here, you will find simple and helpful methods to do that.
- PHP : Remove object from arrayPHP
Here is an example of how to remove an object from an array of objects in PHP:
- Remove a child with a specific attribute, in SimpleXML for PHPPHP
You can remove a child element with a specific attribute in SimpleXML for PHP using the xpath() function.