I would like to create an array with the values from another array "$array" but as keys...
$array= array
(
array(
"name" => "name",
"text" => "Name",
"type" => "input",
"data-error" => "Please enter the client's name.",
"required" => "required"),
array(
"name" => "address",
"text" => "Address",
"type" => "textarea",
"data-error" => "Please enter the address.",
"required" => "required"),
array(
"name" => "email",
"text" => "Email",
"type" => "input",
"data-error" => "Please enter an email address",
"required" => "required"),
array(
"name" => "telephone",
"text" => "Telephone",
"type" => "text",
"data-error" => "Please enter the telephone number",
"required" => "required")
);
Output array should look like:
$new_array = ["name", "address", "email", "telephone"];
how can I create this new array with the information given in $array? It's always the value where key = "name" (first element) in each of the sub-arrays in the Multidimensional array. $array
thank you
$new_array("name"=>array("name","address","email","telephone"),"text"=>...Clarifying your question will not only help SO members that wish to answer your question, but future researchers that have the same issue.