Monday, November 21, 2011

PHP Weird Initialization Criteria

It is weird that before pushing data to an array, one needs to initialize the array before that.

Here's what I did to avoid this weird error (pushed data will be missing):



$my_array = array(); // initialize $my_array is of array type

array_push($my_array, "myTestData1");



If you are used to PERL, this is weird.

1 comment: