I have two class separated on the difference page. What I want to do is to save a value returned from a function and passing it to the another function. I have the code below:
Class publicfunction (on publicfunction.php)
class publicfunction {
public static function getqs() {
$qs = array();
parse_str($_SERVER['QUERY_STRING'], $qs);
}}
Class be_mstpublc (on be_mstpublc.php)
class be_mstpublc {
public static function setmstpublcpgtitle() {
if(!empty($qs['mst'])) {
switch($qs['mst']) {
case 'A':
$pagetitle = "A";
break;
}}}}
Then on another page to implement the function above:
call_user_func(array('publicfunction', 'getqs'));
call_user_func(array('be_mstpublc', 'setmstpublcpgtitle'));
echo $pagetitle;
But it doesn’t return any value.
Any ideas? Thanks..
— EDIT —
I have passed a value on the URL, i.e.: localhost/test/index.php?mst=A
First,
returnthe value, otherwise it doesn’t go anywhere:Then, accept it as a parameter:
Then, pass it: