note 126679 deleted from language.variables.external by cmb

From: Date: Mon, 13 Dec 2021 11:11:25 +0000
Subject: note 126679 deleted from language.variables.external by cmb
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-217362@lists.php.net to get a copy of this message
Note Submitter: krafttoast at fstph dot at ---- Interesting behavior I found while playing with $_GET Using $_GET gives a string , if this string contains an integer, you can still work with it as if it was an integer ( e.g. do addition,multiplication etc). As far as i have tested this behavior it will only work with integer inputs. Here is my example code: <?php /* gets Variables through $_GET and does some arithmetic with them */ $a = $_GET['var1']; $b = $_GET['var2']; $c = $a*$b; $d = $a+$b; $e = sqrt(($a*$a)+($b*$b)); echo ('the multiplication is: ' . $c); echo "<br>"; echo ('the addition is: ' . $d); echo "<br>"; echo ('the pythagorean is :' . $e); echo "<br>"; echo (var_dump($a)); //type of variable is string echo "<br>"; echo (var_dump($b));//type of variable is string ?> /index.php?var1=123&var2=123

« previous php.notes (#217362) next »