Come faccio a chiedere se una variabile *non* vale qualcosa?
Io faccio:
$var = stringa
if stringa == !$var (ecc.)
Ma forse non è corretto...![]()
Come faccio a chiedere se una variabile *non* vale qualcosa?
Io faccio:
$var = stringa
if stringa == !$var (ecc.)
Ma forse non è corretto...![]()
Main: Asus P5KR | Intel Q6600 G0 @ 3.6GHz | Kingston 2x1GB DDR-II @ 800MHz | POV GeForce 8800GT 512MB | Seagate Barracuda 7200.11 32MB 2x500GB RAID0 | Enermax Chakra 3052BS | Enermax Liberty 500W | Zerotherm Nirvana NV120 Premium || eee PC || Net: Atlantis Land WebShare 340 | Alice 19M/1M || Gentoo Linux | gtk-gnutella rulezz.
provaleCodice PHP:
if ($stringa == NULL)
if ($stringa == "")
Ciao.
Statemi bene.$var = 1;
if($var != 0)
{
echo "Var è diversa da zero";
}
Without faith, nothing is possible. With it, nothing is impossible
http://ilwebdifabio.it
Studiati gli operatori di confrontoOriginariamente inviato da Gionnico
Come faccio a chiedere se una variabile *non* vale qualcosa?
Io faccio:
$var = stringa
if stringa == !$var (ecc.)
Ma forse non è corretto...![]()
http://php.html.it/guide/lezione/2300/gli-operatori/
http://se2.php.net/manual/it/languag...comparison.php
Codice PHP:
$var = 1;
if ($var !== '1')
echo "diverso";
else
echo "uguale";
// restituisce diverso perchè fa un confronto anche sul tipo (1 numero con 1 stringa)
echo "
";
if ($var != '1')
echo "diverso";
else
echo "uguale";
// restituisce uguale perchè non fa il confronto sul tipo