php - Array unserialize issue returning null/false -
i've got array being returned in format:
a:1:{i:0;i:305;}   i can't seem unserialize() access 305. have idea on can do?
query in wordpress:
$order_id = $wpdb->get_row("select meta_value wp_postmeta post_id=" . $t->object_id . " , meta_key='wpc_inv_order_id");   i attempted use:
$str = $order_id->meta_value; $a = unserialize($str); var_dump($a); echo $a;   which resulted in bool(false).
however, appears doing echo $order_id->meta_value; somehow unserialized , giving me id value in serialized array.
so doing:
$str = $order_id->meta_value; echo $str;   i'm getting output 305 on above.
thank help!
looking result of unserialize
$str = 'a:1:{i:0;i:305;}'; var_dump($a = unserialize($str));  array(1) {   [0]=>   int(305) }   so take by$a[0];
Comments
Post a Comment