samedi 6 janvier 2018

parse a php file with temp variable

I have a php file like this

if ($a=='number1'){
  $b=2;
  $c=3;
}

elseif ($a=='letterA'){
  $b=33;
  $c=44;
}
  elseif ($a=='something'){
  $b=222;
  $c=3333;
}

Now I want to parse this file and get values "temporarily" for $b and $c. It is to say I need to , set $a variable and get the results for $b and $c

in other words In a php file i need to temporarily set

$a='number1';

so I can extrapolate values of $b and $c without having to actually load the page that now sets the variable.

from within the same file I need to generate

Name: 'number1'; this is setting the $a value
address: '$b'; // corresponding to 'number1 or $a variable
phone: '$c';  // corresponding to 'number1 or $a variable

and

Name: 'letterA'; this is setting the $a value
address: '$b'; // corresponding to letterA or $a variable
phone: '$c';  // corresponding to letterA or $a variable

seems simple enough but I am stuck

thanks in advance

Mark

Aucun commentaire:

Enregistrer un commentaire