riahc3 Posted May 28, 2012 Share Posted May 28, 2012 Hey I have this code........ /*MORE THINGS ABOVE*/ <?php foreach ($_options as $_option) : ?> <?php print_r($_option);?> /*MORE THINGS BELOW*/ That print_r gives me this (the first time around, other times its the same but it just gives me different Xs and Ys which is expected): Array ( [label] => Corte [value] => X: 207 Y: 339 Type: spline#X: 287 Y: 148 Type: spline#X: 453 Y: 170 Type: spline#X: 474 Y: 354 Type: spline#X: 359 Y: 466 Type: spline#X: 270 Y: 436 Type: spline#X: 207 Y: 339 Type: spline# [print_value] => X: 207 Y: 339 Type: spline#X: 287 Y: 148 Type: spline#X: 453 Y: 170 Type: spline#X: 474 Y: 354 Type: spline#X: 359 Y: 466 Type: spline#X: 270 Y: 436 Type: spline#X: 207 Y: 339 Type: spline# [option_id] => 2 [option_type] => area [custom_view] => ) I want to get and retrieve (or print/echo it out) ONLY what is in Corte[value]. How can I retrieve that? I also want to get [option_id] but I imagine if I can get Corte[value] I can problably get [option_id] How can I do it? Thanks! Quote Link to comment https://forums.phpfreaks.com/topic/263254-view-this-value-inside-this-array-or-double-array/ Share on other sites More sharing options...
riahc3 Posted May 28, 2012 Author Share Posted May 28, 2012 Like I mentioned option_id is what I expected: <?php echo($_option['option_id']);?> That works. But <?php echo($_option['Corte']['value']);?> Doesnt.... Quote Link to comment https://forums.phpfreaks.com/topic/263254-view-this-value-inside-this-array-or-double-array/#findComment-1349142 Share on other sites More sharing options...
PravinS Posted May 28, 2012 Share Posted May 28, 2012 You need to check [label] == Corte, then you will get [value] and [option_id], try this below code, it will come in your foreach loop <?php if ($_option['label'] == 'Corte') { echo $_option['value']; echo "<br>".$_option['option_id']; } ?> Quote Link to comment https://forums.phpfreaks.com/topic/263254-view-this-value-inside-this-array-or-double-array/#findComment-1349143 Share on other sites More sharing options...
riahc3 Posted May 28, 2012 Author Share Posted May 28, 2012 You need to check [label] == Corte, then you will get [value] and [option_id], try this below code, it will come in your foreach loop <?php if ($_option['label'] == 'Corte') { echo $_option['value']; echo "<br>".$_option['option_id']; } ?> Indirect your post helped me It was $_option['value'] Thanks Quote Link to comment https://forums.phpfreaks.com/topic/263254-view-this-value-inside-this-array-or-double-array/#findComment-1349169 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.