Get a value out of a multidimensional array [closed]
I have this array below and need to know the var to get the serialized string in ["option_value"]
. My limited understanding leads me to believe it would be $resdata[0]['option_value']
but that returns NULL
.
$resdata =
array(1) { [0]=> array(5) { ["option_id"]=> string(3) "853" ["blog_id"]=> string(1) "0" ["option_name"]=> string(24) "wp_table_reloaded_data_2" ["option_value"]=> string(1125) "a:9:{s:2:"id";i:2;s:11:"category_id";s:1:"2";s:4:"name";s:20:"Copy of Test Table 1";s:11:"description";s:27:"
This is a test table
";s:10:"visibility";a:2:{s:4:"rows";a:2:{i:0;b:0;i:1;b:0;}s:7:"columns";a:3:{i:0;b:0;i:1;b:0;i:2;b:0;}}s:4:"data";a:2:{i:0;a:3:{i:0;s:14:"
test 1a
";i:1;s:19:"
test 1b blah
";i:2;s:14:"
test 1c
";}i:1;a:3:{i:0;s:14:"
test 2a
";i:1;s:14:"
test 2b
";i:2;s:14:"
test 2c
";}}s:7:"options";a:19:{s:22:"alternating_row_colors";b:1;s:19:"print_name_position";s:5:"above";s:26:"print_description_position";s:5:"below";s:18:"cache_table_output";b:1;s:16:"custom_css_class";s:0:"";s:15:"use_tablesorter";b:1;s:15:"datatables_sort";b:1;s:19:"datatables_paginate";b:1;s:27:"datatables_paginate_entries";i:10;s:23:"datatables_lengthchange";b:1;s:17:"datatables_filter";b:1;s:15:"datatables_info";b:1;s:25:"datatables_customcommands";s:0:"";s:9:"row_hover";b:0;s:12:"first_row_th";b:0;s:12:"table_footer";b:0;s:10:"print_name";b:0;s:17:"print_description";b:0;s:21:"datatables_tabletools";b:0;}s:13:"last_modified";s:19:"2011-07-01 23:21:31";s:14:"last_editor_id";s:1:"6";}" ["autoload"]=> string(3) "yes" } }
What you have should be working. How are you trying to use it? Are you trying to echo or print it?
foreach($resdata as $v){
echo $v['option_value']
}
精彩评论