Visualizzazione dei risultati da 1 a 3 su 3

Discussione: watch out count

  1. #1

    watch out count

    Ciao.
    C'è scritto


    If var is not an array or an object with implemented Countable interface, 1 will be returned. There is one exception, if var is NULL, 0 will be returned.
    ma PP non si può stare + tranquilli
    neanche con il classico
    count($result) > 0


    Codice PHP:
    var_dump(count(false)) 
    indovinate cosa restituisce



    Without faith, nothing is possible. With it, nothing is impossible
    http://ilwebdifabio.it

  2. #2
    Moderatore di Off Topic, Kickstarter e XML L'avatar di Sky
    Registrato dal
    Jul 2000
    residenza
    Roma
    Messaggi
    1,053
    Si dovrebbe prima verificare che il recupero dei dati in un array avvenga correttamente, poi contare quanti elementi contiene
    Lo Stato deve dare ai cittadini, come diritto, ciò che la mafia dà come favore.
    Carlo Alberto dalla Chiesa

    Facebook | Twitter | Last.fm | LinkedIn | Quora

  3. #3
    Questa dovrebbe essere una buona
    opzione

    Codice PHP:
    $value false;
    var_dump(isset($value[0])); 

    e se usare empty.
    Without faith, nothing is possible. With it, nothing is impossible
    http://ilwebdifabio.it

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.