$list_box_contents = array();
$list_box_contents[0] = array('params' => 'class="productListing-odd"');
$list_box_contents[0][] = array('params' => 'class="productListing-data"',
'text' => TEXT_NO_PRODUCTS);
i want to make a condition whether there is a value in $list_box_contents[0][]["text"] .when i write the code if(!empty($list_box_contents[0][]["text"])). my IDE alet me there is an error. what’s wrong with it?
[] it’s not a position, index or something like this.
With
you are pushing the array with its two value (and keys) on the right of the
=in the last position of the subarray which has index 0. That is the structure you’ll have is:Anyway to have an idea of what happens, you can use
print_r($list_box_contents)orvar_dump($list_box_contents)after the lines you posted.