I have an array Array ( [email] => [email protected] [mobileNo] => 9999999999 )
How to store
$email = '[email protected]'
$mobileNo = '9999999999'
into variables the key and value
I have an array Array ( [email] => [email protected] [mobileNo] => 9999999999 )
How to store
$email = '[email protected]'
$mobileNo = '9999999999'
into variables the key and value
Just try with extract
$input = array('email' => '[email protected]', 'mobileNo' => 9999999999);
extract($input);
var_dump($email, $mobileNo);
Output:
string '[email protected]' (length=12)
int 9999999999
extract()does exactly that, but consider if you really want to. Leaving them as array keys often makes for much more organized code assuming these values are related...