note 123206 deleted from reserved.variables.server by crell

From: Date: Thu, 31 Mar 2022 19:02:32 +0000
Subject: note 123206 deleted from reserved.variables.server by crell
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-217886@lists.php.net to get a copy of this message
Note Submitter: razvan_bc at yahoo dot com ---- In 2018 things can be pretty cool !!! look around: <?php //save it index.php in a root folder /* if($_SERVER["REQUEST_METHOD"]!='GET'){ echo('it`s a POST'); }else{ echo('it`s a GET'); } */ $_REQ =& $_SERVER["REQUEST_METHOD"]; ($_REQ=='POST')and($what='it`s a POST'); ($_REQ=='GET')and($what='it`s a GET'); isset($what) and print($what); ?> <form method="POST" action=""> <input type="text" name="postbaby" value="sadasdsa"> <input type="submit" value="POST THAT"> </form> <br> <form method="GET" action=""> <input type="text" name="getbaby" value="sadasdsa"> <input type="submit" value="GET THAT"> </form> <hr><?php phpinfo(); ?> what if you have a class with controllers? i hope will not be depreciated cause STATIC CALLS I TEST ALREADY ARE VERY FAST: <?php //save it index.php in a root folder /* if($_SERVER["REQUEST_METHOD"]!='GET'){ echo('it`s a POST'); }else{ echo('it`s a GET'); } */ class forms { public static function type(){ return $_SERVER["REQUEST_METHOD"]; } public static function post($f){ (self::type()=='POST')and $f(); } public static function get($f){ (self::type()=='GET')and $f(); } } ?> <form method="POST" action=""> <input type="text" name="postbaby" value="sadasdsa"> <input type="submit" value="POST THAT"> </form> <br> <form method="GET" action=""> <input type="text" name="getbaby" value="sadasdsa"> <input type="submit" value="GET THAT"> </form> <hr><?php forms::post(function(){ $what='it`s a POST';echo($what); }); forms::get(function(){ $what='it`s a GET';echo($what); }); //phpinfo(); ?>

« previous php.notes (#217886) next »