You can cast a variable to an array by using:
$var = (array)$arr;
More Related Contents:
- “Notice: Undefined variable”, “Notice: Undefined index”, “Warning: Undefined array key”, and “Notice: Undefined offset” using PHP
- How to convert an array to object in PHP?
- How to add elements to an empty array in PHP?
- PHP Multiple Checkbox Array
- How create an array from the output of an array printed with print_r?
- Create new variables from array keys in PHP
- Casting an Array with Numeric Keys as an Object
- How to cast array elements to strings in PHP?
- Array to Object and Object to Array in PHP – interesting behaviour
- PHP: Create an array for a range
- Convert a String to Variable
- Access an Array Returned by a Function [duplicate]
- Sum up array values [closed]
- Is there any array function by which I can get the expected result? [duplicate]
- Convert a PHP object to an associative array
- PHP in_array() / array_search() odd behaviour
- How can I check if an array contains a specific value in php?
- PHP list all files in directory [duplicate]
- How to sort a multidimensional array by a certain key?
- How to Cast Objects in PHP
- How to split a long string without breaking words?
- PHP String to Float
- PHP variable interpolation vs concatenation [duplicate]
- PHP – Merge two arrays (same-length) into one associative?
- PHP – Convert multidimensional array to 2D array with dot notation keys
- Loop a multidimensional array and only print two specific column values per row
- Group rows in an associative array of associative arrays by column value and preserve the original first level keys
- PHP get values from SimpleXMLElement array
- Array size limit in PHP
- How are associative arrays implemented in PHP?