Instantiate dynamic array Magento-Collection of common programming errors

I dropped the following code into a controller action

        $data = array();            
        $data[0] = 'test';
        $data[1] = 'what';
        var_dump($data);

And got the following Notice free output

array
  0 => string 'test' (length=4)
  1 => string 'what' (length=4)

So your problem is elsewhere. There’s probably somewhere else in your code where you’re referencing

    $data[0]

in a non-assignment operator way. That’s why you’re getting the Notice.

Originally posted 2013-11-10 00:13:50.