when i am using extract it shows some warnings like ‘PHP Warning: extract() [function.extract]: First argument should be an array ‘
following is the code
$HTTP_RAW_POST_DATA = file_get_contents('php://input');
ob_start();
global $mmb_core;
$data = unserialize(base64_decode($HTTP_RAW_POST_DATA));
$data =array($data);
$num = extract($data);
First of all, you either don’t need line
$data =array($data);or don’t need tounserialize. Which one depends on the format of input. If input is serialized array, then it is enough to onlyunserializeit.You need to make sure that
$datais an associative array. Means that EACH element in it has astring keyand that key fits in variable naming rules (e.g. does not start with number). If it is array, but not an associative array, this error will be produced.Also this function validates whether these keys will overwrite already defined variables. So you need to use proper keys. I would use it this way
That will prepend each key with
data_. Also will work for not associative arrays making variables like$data_0,$data_1etc.For more details you better refer to official documentation