-3

Here is my array and i want to store to a variable , how to do this

array(4) {["FirstName"]=> string(3) "abc" ["LastName"]=> string(5) "cvbcb" ["Email"]=> string(14) "sfsfd@afaf.com"} 
Thamilhan
  • 13,040
  • 5
  • 37
  • 59

2 Answers2

0
$yourArray = array('FirstName' => 'abc', 'LastName' => 'cvbcb', 'Email' => 'sfsfd@afaf.com');
Tom Cash
  • 166
  • 6
  • Although this code may answer the question, providing additional context regarding _why_ and/or _how_ it answers the question would significantly improve its long-term value. Please [edit] your answer to add some explanation. – Toby Speight May 04 '16 at 08:41
0

First of all you have the array like this:

$arr = array('FirstName' => 'abc', 
             'LastName' => 'cvbcb', 
             'Email' => 'sfsfd@afaf.com'
            );

This is a single dimension array so you need to use the index / key with the array name for access and assign each item from the array. Here is the demo.

$firstName = $arr['FirstName']; // abc
$LastName = $arr['LastName']; // cvbcb
$Email = $arr['Email']; // sfsfd@afaf.com
Murad Hasan
  • 9,565
  • 2
  • 21
  • 42