create empty array in php

To create an empty array in PHP, you can use the array() function with no arguments. Here's an example:

main.php
$myArray = array();
20 chars
2 lines

You can also use the shorthand syntax:

main.php
$myArray = [];
15 chars
2 lines

Either way, $myArray will be an empty array that you can add elements to using the [] syntax or the array_push() function.

related categories

gistlibby LogSnag