0

Here is my array:

Array ( [username] => john [email] => [email protected] [first_name] => John [last_name] => Bobby)

how can i assign each value a key variable? for example,

$key = $value

so in this case, it would be:

$username = 'john';
$email = '[email protected]';
etc...

1 Answer 1

1

Possibly you need php.extract: http://php.net/manual/en/function.extract.php

$array = ['username' => 'John', ...];
extract($array);
echo $username; // John

otherwise just echo $array['username'] // John
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.