Loading:


    count_chars()

    Zwraca informacje na temat znaków używanych w ciągu.

     

    W zależności od trybu count_chars () zwraca jedną z następujących czynności:

         * 0 - tablicę z bajtowy klucz-wartość, jak i częstotliwość każdy bajt jako wartość.
         * 1 - tak samo jak 0 bajtów, ale tylko wartości z częstotliwością większą niż zero są wymienione.
         * 2 - tak samo jak 0 bajtów, ale tylko wartości z częstotliwością równą zero są wymienione.
         * 3 - ciąg znaków zawierający wszystkie unikalne jest zwracany.
         * 4 - ciąg zawierający wszystkie znaki używane nie jest zwracany.

     

    Kompatybilność: PHP4, PHP5.



    Napisz Artyku³

    Listing

    <?php
    $data = "Two Ts and one F.";

    foreach (count_chars($data, 1) as $i => $val) {
       echo "There were $val instance(s) of \"" , chr($i) , "\" in the string.\n";
    }
    ?>

    Powyższy przykład wyświetli:

    There were 4 instance(s) of " " in the string.
    There were 1 instance(s) of "." in the string.
    There were 1 instance(s) of "F" in the string.
    There were 2 instance(s) of "T" in the string.
    There were 1 instance(s) of "a" in the string.
    There were 1 instance(s) of "d" in the string.
    There were 1 instance(s) of "e" in the string.
    There were 2 instance(s) of "n" in the string.
    There were 2 instance(s) of "o" in the string.
    There were 1 instance(s) of "s" in the string.
    There were 1 instance(s) of "w" in the string.




    Dodano przez: divix
    Ranga: Administrator serwisu Punktów: 0
    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-2025 v.1.5 | design: diviXdesign & rainbowcolors