php - How to write a function similar to $_GET? -


is there function works $_get ? mean function transforms

"?var1=5&var2=true" 

to

$var1=5;  $var2="true"; 

so can use 1 variable (string) in function , fetch many variables it?

like:

function manual_get($args){ /* ? */}  function myfunction($args) { manual_get($args);  if(isset($var1))/* doesn't have way, btw */  {    do_something($var1);  }  //etc } 

p.s. : don't want use $_get url because file class file (namely database_library.php) don't execute directly, or make ajax call. require_once(); it.

yes, there is. called parse_str: http://php.net/manual/en/function.parse-str.php


Comments

Popular posts from this blog

c++ - Function signature as a function template parameter -

algorithm - What are some ways to combine a number of (potentially incompatible) sorted sub-sets of a total set into a (partial) ordering of the total set? -

How to call a javascript function after the page loads with a chrome extension? -