vendredi 2 janvier 2015

How to create a PHP rule with if statement and push an certain array?

How can I create a PHP if rule(s) and push a certain php array:


Let's say I have 3 numerical values that come from POST:



$Tanks= intval($_POST["Tanks"]);
$Fish= intval($_POST["Fish"]);
$Vegetables= intval($_POST["Vegetables"]);


The request is:



Request: Tanks -> 2; Fish -> 4; Vegetables ->1


And I want to create PHP IF rule(s) if the above results are met to push the below array(s):



array_push($tank,array("objType" => "Fish"), array("objType" => "Fish"));
array_push($tank,array("objType" => "Fish"), array("objType" => "Fish"), array("objType" => "Vegetables"));


I have spent several days with this matter and hope that the new year to bring me the answer.


Aucun commentaire:

Enregistrer un commentaire