{"id":1276,"date":"2022-08-30T15:15:11","date_gmt":"2022-08-30T15:15:11","guid":{"rendered":"https:\/\/unknownerror.org\/index.php\/2013\/11\/10\/instantiate-dynamic-array-magento-collection-of-common-programming-errors\/"},"modified":"2022-08-30T15:15:11","modified_gmt":"2022-08-30T15:15:11","slug":"instantiate-dynamic-array-magento-collection-of-common-programming-errors","status":"publish","type":"post","link":"https:\/\/unknownerror.org\/index.php\/2022\/08\/30\/instantiate-dynamic-array-magento-collection-of-common-programming-errors\/","title":{"rendered":"Instantiate dynamic array Magento-Collection of common programming errors"},"content":{"rendered":"<p>I dropped the following code into a controller action<\/p>\n<pre><code>        $data = array();            \n        $data[0] = 'test';\n        $data[1] = 'what';\n        var_dump($data);\n<\/code><\/pre>\n<p>And got the following Notice free output<\/p>\n<pre><code>array\n  0 =&gt; string 'test' (length=4)\n  1 =&gt; string 'what' (length=4)\n<\/code><\/pre>\n<p>So your problem is elsewhere. There&#8217;s probably somewhere else in your code where you&#8217;re referencing<\/p>\n<pre><code>    $data[0]\n<\/code><\/pre>\n<p>in a non-assignment operator way. That&#8217;s why you&#8217;re getting the Notice.<\/p>\n<p id=\"rop\"><small>Originally posted 2013-11-10 00:13:50. <\/small><\/p>","protected":false},"excerpt":{"rendered":"<p>I dropped the following code into a controller action $data = array(); $data[0] = &#8216;test&#8217;; $data[1] = &#8216;what&#8217;; var_dump($data); And got the following Notice free output array 0 =&gt; string &#8216;test&#8217; (length=4) 1 =&gt; string &#8216;what&#8217; (length=4) So your problem is elsewhere. There&#8217;s probably somewhere else in your code where you&#8217;re referencing $data[0] in a [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[10,1],"tags":[],"class_list":["post-1276","post","type-post","status-publish","format-standard","hentry","category-magento","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/1276","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/comments?post=1276"}],"version-history":[{"count":1,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/1276\/revisions"}],"predecessor-version":[{"id":9030,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/1276\/revisions\/9030"}],"wp:attachment":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/media?parent=1276"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/categories?post=1276"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/tags?post=1276"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}