Picabrillo Posted January 4, 2007 Share Posted January 4, 2007 Hi,I can't see what's wrong with this. I've been looking at it for a long time, so maybe a fresh perspective might help.I created the multi-dimensional array like so:[code]<?php$array = array();$array['options']['option1'] = array('id');$array['options']['option2'] = 'name';$array['options']['option3'] = 'age';$array['options']['option4'] = 'address';?>[/code]But when later in the script I tested to see if option1 exists with isset($array['options']['option1']) it failed. I checked $array with print_r and it looked like this:[code]Array ( [0] => id) Array ( [options] => Array ( [option2] => name [option3] => age [option4] => address ) )[/code] All the other options are fine, I can test them with isset and they come back true. Can anyone give me any idea why option1 isn't a part of the options array even when I stated it?Thanks in advance people! Quote Link to comment https://forums.phpfreaks.com/topic/32869-solved-multidimensional-arrays/ Share on other sites More sharing options...
sasa Posted January 4, 2007 Share Posted January 4, 2007 it works fine in my machine in PHP 4.4.1 and PHP 5.1.1 Quote Link to comment https://forums.phpfreaks.com/topic/32869-solved-multidimensional-arrays/#findComment-153075 Share on other sites More sharing options...
Picabrillo Posted January 4, 2007 Author Share Posted January 4, 2007 I feel like such a donut!I've found the source of the problem. Unfortunately it was completely unrelated to anything I posted, so even the best person wouldn't have worked it out. What I posted was only a segment of a bigger program, but I'd ruled out any possibility that the problem was anywhere else. How wrong I was!!Sorry about that. The fact it worked for you Sasa made me think it was probably elsewhere, so thank you.I shall now go and enroll myself back into Primary school!! Quote Link to comment https://forums.phpfreaks.com/topic/32869-solved-multidimensional-arrays/#findComment-153125 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.