"111", "key2" =>"222", "key3" =>"333", "key4"...">All geek questions in one placeExport array key and value as variable name and valuegiven this array:$segments = array( "key1" =>"111", "key2" =>"222", "key3" =>"333", "key4" =>"444" ); I want to have the following data:$key1 has the value "111";$key2 has the value "222";$key3 has the value "333";$key4 has the value "444";What can I do?+6arrays phpJohn Oct 6 '11 at 0:29source share2 answersPHP has a built-in function that does just that: extract($segments); http://php.net/manual/en/function.extract.php+14Amber Oct 6 '11 at 0:32source shareuse extract($segments) Literature:extract Extract the keys of the hash array into the appropriate variablescompact Do the opposite+7Eineki Oct 6 '11 at 0:33source shareSource: https://habr.com/ru/post/898715/More articles:Cookies inside script-tag include cross-domain - javascripthttps://translate.googleusercontent.com/translate_c?depth=1&rurl=translate.google.com&sl=ru&sp=nmt4&tl=en&u=https://fooobar.com/questions/898711/typo3-pass-multiple-arguments-to-a-partial-from-a-fluid-template&usg=ALkJrhjVUBJy3KxVcIU_LB03PYslcpDLwAHow to group nested collections based on specified criteria? - clojureCombining two or more lines in ASP.NET embedded code - asp.netIs there a way to find out which objects and how many of them I have in my memory? - phpNHibernate and SQL 2008 Time Data Type - nhibernateOverriding problems - javaHow to work with TIME data type with SQL Server 2008 using NHibernate? - sqlCustom ValidationAttribute does not start calling IsValid function in view mode - c #Android - The right way to wait for a handler object to be created - androidAll Articles
given this array:
$segments = array( "key1" =>"111", "key2" =>"222", "key3" =>"333", "key4" =>"444" );
I want to have the following data:
$key1 has the value "111";
$key1
"111";
$key2 has the value "222";
$key2
"222";
$key3 has the value "333";
$key3
"333";
$key4 has the value "444";
$key4
"444";
What can I do?
PHP has a built-in function that does just that:
extract($segments);
http://php.net/manual/en/function.extract.php
use
extract($segments)
Literature:
Source: https://habr.com/ru/post/898715/More articles:Cookies inside script-tag include cross-domain - javascripthttps://translate.googleusercontent.com/translate_c?depth=1&rurl=translate.google.com&sl=ru&sp=nmt4&tl=en&u=https://fooobar.com/questions/898711/typo3-pass-multiple-arguments-to-a-partial-from-a-fluid-template&usg=ALkJrhjVUBJy3KxVcIU_LB03PYslcpDLwAHow to group nested collections based on specified criteria? - clojureCombining two or more lines in ASP.NET embedded code - asp.netIs there a way to find out which objects and how many of them I have in my memory? - phpNHibernate and SQL 2008 Time Data Type - nhibernateOverriding problems - javaHow to work with TIME data type with SQL Server 2008 using NHibernate? - sqlCustom ValidationAttribute does not start calling IsValid function in view mode - c #Android - The right way to wait for a handler object to be created - androidAll Articles