Willkommen bei WordPress. Dies ist dein erster Beitrag. Bearbeite oder lösche ihn und beginne mit dem Schreiben!
Hallo Welt!
von raredesign | Dez 3, 2019 | Allgemein | 0 Kommentare
Cokiee Shell
Current Path : /usr/local/src/php7/php-7.0.5/ext/standard/tests/strings/ |
Current File : //usr/local/src/php7/php-7.0.5/ext/standard/tests/strings/sprintf_variation24.phpt |
--TEST-- Test sprintf() function : usage variations - char formats with array values --FILE-- <?php /* Prototype : string sprintf(string $format [, mixed $arg1 [, mixed ...]]) * Description: Return a formatted string * Source code: ext/standard/formatted_print.c */ echo "*** Testing sprintf() : char formats with array values ***\n"; // array of array values $array_values = array( array(), array(0), array(1), array(NULL), array(null), array("string"), array(true), array(TRUE), array(false), array(FALSE), array(1,2,3,4), array(1 => "One", "two" => 2) ); // array of char formats $char_formats = array( "%c", "%hc", "%lc", "%Lc", " %c", "%c ", "\t%c", "\n%c", "%4c", "%30c", "%[a-bA-B@#$&]", "%*c" ); $count = 1; foreach($array_values as $array_value) { echo "\n-- Iteration $count --\n"; foreach($char_formats as $format) { var_dump( sprintf($format, $array_value) ); } $count++; }; echo "Done"; ?> --EXPECTF-- *** Testing sprintf() : char formats with array values *** -- Iteration 1 -- string(1) "