Visualizzazione dei risultati da 1 a 2 su 2
  1. #1

    se le prime tre lettere equivalgono a ...

    Salve a tutti.
    devo creare uno script if del tipo "se le prime quattro lettere della variabile sono
    scrivi ecc. ecc."
    quindi una cosa del genere
    Codice PHP:
    if (prime_tre_cifre_$variabile == "
    "
    ) {
              echo 
    "aa";
                } else {
              echo 
    "bb";
               } 
    Meglio ancora s emi suggerite qualche funzione per poter "isolare" le prime 4 cifre.

    Come dovrei fare?????

  2. #2
    Return part of a string (PHP 3, PHP 4, PHP 5)

    string substr ( string string, int start [, int length] )

    substr() returns the portion of string specified by the start and length parameters.

    If start is non-negative, the returned string will start at the start'th position in string, counting from zero. For instance, in the string 'abcdef', the character at position 0 is 'a', the character at position 2 is 'c', and so forth.

    (copia / incolla della doc PHP, una piccola lettura è sempre utile...)

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 © 2024 vBulletin Solutions, Inc. All rights reserved.