Hello all,
I have a question about unserializing a single array element from a
serialized array. Can this be done, or must I first unserialize the
array, and then access the element?
For example, given:
$data = serialize(array ('4.50','0.00', '0.00'));
Can I unserialize individual elements from $data, such as:
$data_element = unserialize($da ta[2]);
As it is now, PHP will generate a syntax error, forcing me instead to
unserialize the entire array before accessing it:
$new_data = unserialize($da ta);
$data_element = $new_data[2];
NOTE the value in this is as it relates to CONSTANTS, where arrays must
be serialized before define()'d as a constant.
thanks,
rich
I have a question about unserializing a single array element from a
serialized array. Can this be done, or must I first unserialize the
array, and then access the element?
For example, given:
$data = serialize(array ('4.50','0.00', '0.00'));
Can I unserialize individual elements from $data, such as:
$data_element = unserialize($da ta[2]);
As it is now, PHP will generate a syntax error, forcing me instead to
unserialize the entire array before accessing it:
$new_data = unserialize($da ta);
$data_element = $new_data[2];
NOTE the value in this is as it relates to CONSTANTS, where arrays must
be serialized before define()'d as a constant.
thanks,
rich
Comment