Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PHP

connect an if statement to an input php


re: #80305

Again useful for newbies:

if you need to compare a variable with a value, instead of doing

<?php
if ($foo == 3) bar();
?>

do

<?php
if (3 == $foo) bar();
?>

this way, if you forget a =, it will become

<?php
if (3 = $foo) bar();
?>

and PHP will report an error.
Source by www.php.net #
 
PREVIOUS NEXT
Tagged: #connect #statement #input #php
ADD COMMENT
Topic
Name
5+8 =