This is how looks my var_dump variable.
object(stdClass)#879 (3) {
["row"]=>
array(1) {
["option_id"]=>
string(2) "20"
}
["rows"]=>
array(1) {
[0]=>
array(1) {
["option_id"]=>
string(2) "20"
}
}
["num_rows"]=>
int(1)
}
I need to get option_id in this case option_id = 20
e.g. $option_id = 20
When I try this $variable['row']['option_id']
I get null value.
The variable is an object of stdClass
, so you have to access the properties instead of an index. For example:
$variable->num_rows
If you want to get the option_id
, you have to use this (combine object and array syntax):
$option_id = $variable->row["option_id"];