Toggle navigation
Home
Latest pastes
FAQ
Random
Register
Login
PHP - The if statement
SUBMITTED BY:
KkK1337
DATE:
June 27, 2017, 2:31 a.m.
FORMAT:
PHP
SIZE:
482 Bytes
Raw
Download
Tweet
HITS:
704
Go to comments
Report
Example 1
<?php
$foo
=
1
;
$bar
=
2
;
if
(
$foo
==
$bar
)
{
echo
"
$foo
is equal to
$bar
."
;
}
elseif
(
$foo
>
$bar
)
{
echo
"
$foo
is greater than
$bar
."
;
}
else
{
echo
"
$foo
is less than
$bar
."
;
}
?>
Example 2
<?php
$lower
=
10
;
$upper
=
100
;
$needle
=
25
;
if
((
$needle
>=
$lower
)
&&
(
$needle
<=
$upper
))
{
echo
"The needle is in the haystack."
;
}
elseif
((
$needle
<=
$lower
)
||
(
$needle
>=
$upper
))
{
echo
"The needle is outside of the haystack."
;
}
?>
Please enable JavaScript to view the
comments powered by Disqus.
comments powered by
Disqus