wds Posted July 20, 2007 Share Posted July 20, 2007 here's my dilemma, i want to create my cart array to house all of the customer's selections. the $image array will serve two purposes. $image will be used to identify which image they wish to purchase, and with each image there will be 3 values denoting the quantity of each size of picture they want (4x6, 5x8, & 8x10). now, i can call for the value of $cart[3]['four'][0] just fine, as long as the sub-arrays "five" and "eight" do not exist. any ideas how to go about this? THIS SCRIPT WORKS: $image = 3; $cart = array( $image => array( "four" => array( "3" ) ) ); print("<html><head></head><body>" . $cart[3]['four'][0] . "</body></html>"); THIS SCRIPT DOES NOT WORK: $image = 3; $cart = array( $image => array( "four" => array( "3" ) "five" => array( "4" ) "eight" => array( "1" ) ) ); print("<html><head></head><body>" . $cart[3]['four'][0] . "</body></html>"); THIS IS DRIVING ME CRAZY. Thank you for your input. Link to comment https://forums.phpfreaks.com/topic/60896-solved-array-inside-an-array-inside-an-array/ Share on other sites More sharing options...
clearstatcache Posted July 20, 2007 Share Posted July 20, 2007 u try ds.... THIS SCRIPT DOES NOT WORK: $image = 3; $cart = array( $image => array( "four" => array( "3" ), "five" => array( "4" ), "eight" => array( "1" ) ) ); print("<html><head></head><body>" . $cart[3]['four'][0] . "</body></html>"); Link to comment https://forums.phpfreaks.com/topic/60896-solved-array-inside-an-array-inside-an-array/#findComment-303043 Share on other sites More sharing options...
wds Posted July 21, 2007 Author Share Posted July 21, 2007 clear, thank you so much!!! i can't believe it was just a simple syntax error... sometimes it's just the simplest things, i can't believe i overlooked that!!! i am so happy right now, cheers to you sir. Link to comment https://forums.phpfreaks.com/topic/60896-solved-array-inside-an-array-inside-an-array/#findComment-303803 Share on other sites More sharing options...
clearstatcache Posted July 21, 2007 Share Posted July 21, 2007 ur welcum....godblez u.... Link to comment https://forums.phpfreaks.com/topic/60896-solved-array-inside-an-array-inside-an-array/#findComment-303812 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.