Visualizzazione dei risultati da 1 a 4 su 4

Discussione: [newbie] "not"

  1. #1

    [newbie] "not"

    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.

  2. #2
    Codice PHP:
    if ($stringa == NULL)
    if (
    $stringa == ""
    provale

  3. #3

    la sintassi ...

    Ciao.
    $var = 1;
    if($var != 0)
    {
    echo "Var è diversa da zero";
    }
    Statemi bene.
    Without faith, nothing is possible. With it, nothing is impossible
    http://ilwebdifabio.it

  4. #4
    Utente di HTML.it L'avatar di nicola75ss
    Registrato dal
    Nov 2004
    Messaggi
    12,922

    Re: [newbie] "not"

    Originariamente 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...
    Studiati gli operatori di confronto
    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 

Permessi di invio

  • Non puoi inserire discussioni
  • Non puoi inserire repliche
  • Non puoi inserire allegati
  • Non puoi modificare i tuoi messaggi
  •  
Powered by vBulletin® Version 4.2.1
Copyright © 2025 vBulletin Solutions, Inc. All rights reserved.