jmartinsen
-
Posts
3 -
Joined
-
Last visited
Posts posted by jmartinsen
-
-
Just setup a script that gets a code, checks it and echoes out the status of it.
<?php /** * http://fastrak.com/track.php?code=ABCDEFGHIJ */ // get the CODE from the GET varaible $code = isset($_GET["code"]) ? $_GET["code"] : ""; // to whatever you need to do to check if that $code is valid // if its not valid return an 404 error // then get the status of that code $return = array( "status" => "get this status from the database or whatever", ); // and echo that out echo json_encode($return); ?>
-
Hi all.
What's the best practice with using the Ternary Operator vs. the Error Control Operator when setting a simple varaible? I doubt there is any performance issues?
<?php $var = isset($_GET["var"]) ? $_GET["var"] : ""; $var = @$_GET["var"]; ?>
Setting A Variable, Ternary Operator Vs. Error Control Operator
in Application Design
Posted
Oh, you're absolutely right. I first thought that the @ ignored the error handler altogether, but it doesnt. It calls it, but just doesnt do anything with it. I did a supersimple test and it shows that the ternary operator was 4 times faster.
With performance out of the picture any thoughts on using one over the other?