Loading:


bool is_numeric
bool is_numeric ($var )

 

Stwierdza, czy zmienna to liczba lub ciąg liczbowy

Parametry

var

ocena zmiennej


Zwracane wartości

Returns TRUE if var is a number or a numeric string, FALSE otherwise.



Napisz Artyku³

Listing



//Example #1 is_numeric() examples

<?php
$tests = Array(
        "42",
        1337,
        "1e4",
        "not numeric",
        Array(),
        9.1
        );

foreach($tests as $element)
{
    if(is_numeric($element))
    {
        echo "'{$element}' to numer", PHP_EOL;
    }
    else
    {
        echo "'{$element}' to nie numer", PHP_EOL;
    }
}
?>
 




Dodano przez: igor
Ranga: Administrator serwisu Punktów: 28716
Komentarze użytkowników
    • Tre¶æ komentarza
      Kod do komentarza (opcjonalnie)
      PHP JavaScript MySQL Smarty SQL HTML CSS ActionScript
      Autor
      Token
      token

       

       








funkcje.net
Wszelkie prawa zastrzeżone©. | Funkcje.net 2008-2024 v.1.5 | design: diviXdesign & rainbowcolors