switch($_GET['human']){
case $_GET['human']:($computer==$_GET['human'])?”draw”;break:NULL /*NO BREAK */;
case 0:($computer==1)?”win”:”lose”;break;
case 1:($computer==2)?”win”:”lose”;break;
case 2:($computer==0)?”win”:”lose”;break;
}
//SQL
You don’t have to check if a function equals TRUE or FALSE. If it’s true if(isset($_GET['item'])) works the same if you checked if it’s equal to true. And when it comes to false you can just use if(!in_array($item,$items)) instead of checking if it actually returns false. The exclamation point will do the same. And since the isset function checks if the variable EXISTS, it does not check if it has a value. You can do $item = $_GET['item'] and as long ?item= is in the URL it will return true.
yes
thx but can you give as a source code….
can i use notepad?
BOOORING! As simple as:
switch($_GET['human']){
case $_GET['human']:($computer==$_GET['human'])?”draw”;break:NULL /*NO BREAK */;
case 0:($computer==1)?”win”:”lose”;break;
case 1:($computer==2)?”win”:”lose”;break;
case 2:($computer==0)?”win”:”lose”;break;
}
//SQL
Can We Get a source ?
Nice video, but your code is very unoptimized…
Thanks
Good tutorial for beginners though, good job.
Thanks, I know I don’t have to add ( == TRUE ) but I prefer that, but I never paid attention to make sure it had a value.
If you do if($_GET['item']) that checks to see if it exists and HAS a value. This method is generally more efficient than using isset
You don’t have to check if a function equals TRUE or FALSE. If it’s true if(isset($_GET['item'])) works the same if you checked if it’s equal to true. And when it comes to false you can just use if(!in_array($item,$items)) instead of checking if it actually returns false. The exclamation point will do the same. And since the isset function checks if the variable EXISTS, it does not check if it has a value. You can do $item = $_GET['item'] and as long ?item= is in the URL it will return true.
nice vid man!