repo
stringlengths
7
63
file_url
stringlengths
81
284
file_path
stringlengths
5
200
content
stringlengths
0
32.8k
language
stringclasses
1 value
license
stringclasses
7 values
commit_sha
stringlengths
40
40
retrieved_at
stringdate
2026-01-04 15:02:33
2026-01-05 05:24:06
truncated
bool
2 classes
lkrms/pretty-php
https://github.com/lkrms/pretty-php/blob/5d244a4b7a9b484581edbb5df596a4e76ba17fa6/tests/fixtures/Formatter/in/3rdparty/php-doc/language/operators/assignment/000.php
tests/fixtures/Formatter/in/3rdparty/php-doc/language/operators/assignment/000.php
<?php $a = ($b = 4) + 5; // $a is equal to 9 now, and $b has been set to 4. var_dump($a); ?>
php
MIT
5d244a4b7a9b484581edbb5df596a4e76ba17fa6
2026-01-05T04:31:39.990954Z
false
lkrms/pretty-php
https://github.com/lkrms/pretty-php/blob/5d244a4b7a9b484581edbb5df596a4e76ba17fa6/tests/fixtures/Formatter/in/3rdparty/php-doc/language/operators/bitwise/001.php
tests/fixtures/Formatter/in/3rdparty/php-doc/language/operators/bitwise/001.php
<?php echo 12 ^ 9, PHP_EOL; // Outputs '5' echo "12" ^ "9", PHP_EOL; // Outputs the Backspace character (ascii 8) // ('1' (ascii 49)) ^ ('9' (ascii 57)) = #8 echo "hallo" ^ "hello", PHP_EOL; // Outputs the ascii values #0 #4 #0 #0 #0 // 'a' ^ 'e' = #4 echo 2...
php
MIT
5d244a4b7a9b484581edbb5df596a4e76ba17fa6
2026-01-05T04:31:39.990954Z
false
lkrms/pretty-php
https://github.com/lkrms/pretty-php/blob/5d244a4b7a9b484581edbb5df596a4e76ba17fa6/tests/fixtures/Formatter/in/3rdparty/php-doc/language/operators/bitwise/002.php
tests/fixtures/Formatter/in/3rdparty/php-doc/language/operators/bitwise/002.php
<?php /* * Here are the examples. */ echo "\n--- BIT SHIFT RIGHT ON POSITIVE INTEGERS ---\n"; $val = 4; $places = 1; $res = $val >> $places; p($res, $val, '>>', $places, 'copy of sign bit shifted into left side'); $val = 4; $places = 2; $res = $val >> $places; p($res, $val, '>>', $places); $val = 4; $places = 3; ...
php
MIT
5d244a4b7a9b484581edbb5df596a4e76ba17fa6
2026-01-05T04:31:39.990954Z
false
lkrms/pretty-php
https://github.com/lkrms/pretty-php/blob/5d244a4b7a9b484581edbb5df596a4e76ba17fa6/tests/fixtures/Formatter/in/3rdparty/php-doc/language/operators/bitwise/000.php
tests/fixtures/Formatter/in/3rdparty/php-doc/language/operators/bitwise/000.php
<?php /* * Ignore the top section, * it is just formatting to make output clearer. */ $format = '(%1$2d = %1$04b) = (%2$2d = %2$04b)' . ' %3$s (%4$2d = %4$04b)' . "\n"; echo <<<EOH --------- --------- -- --------- result value op test --------- --------- -- --------- EOH; /* * H...
php
MIT
5d244a4b7a9b484581edbb5df596a4e76ba17fa6
2026-01-05T04:31:39.990954Z
false
lkrms/pretty-php
https://github.com/lkrms/pretty-php/blob/5d244a4b7a9b484581edbb5df596a4e76ba17fa6/tests/fixtures/Formatter/in/3rdparty/php-doc/language/operators/increment/001.php
tests/fixtures/Formatter/in/3rdparty/php-doc/language/operators/increment/001.php
<?php echo '== Alphabetic strings ==' . PHP_EOL; $s = 'W'; for ($n=0; $n<6; $n++) { echo ++$s . PHP_EOL; } // Alphanumeric strings behave differently echo '== Alphanumeric strings ==' . PHP_EOL; $d = 'A8'; for ($n=0; $n<6; $n++) { echo ++$d . PHP_EOL; } $d = 'A08'; for ($n=0; $n<6; $n++) { echo ++$d . PHP_E...
php
MIT
5d244a4b7a9b484581edbb5df596a4e76ba17fa6
2026-01-05T04:31:39.990954Z
false
lkrms/pretty-php
https://github.com/lkrms/pretty-php/blob/5d244a4b7a9b484581edbb5df596a4e76ba17fa6/tests/fixtures/Formatter/in/3rdparty/php-doc/language/operators/increment/002.php
tests/fixtures/Formatter/in/3rdparty/php-doc/language/operators/increment/002.php
<?php $s = "5d9"; var_dump(++$s); var_dump(++$s); ?>
php
MIT
5d244a4b7a9b484581edbb5df596a4e76ba17fa6
2026-01-05T04:31:39.990954Z
false
lkrms/pretty-php
https://github.com/lkrms/pretty-php/blob/5d244a4b7a9b484581edbb5df596a4e76ba17fa6/tests/fixtures/Formatter/in/3rdparty/php-doc/language/operators/increment/000.php
tests/fixtures/Formatter/in/3rdparty/php-doc/language/operators/increment/000.php
<?php echo 'Post-increment:', PHP_EOL; $a = 5; var_dump($a++); var_dump($a); echo 'Pre-increment:', PHP_EOL; $a = 5; var_dump(++$a); var_dump($a); echo 'Post-decrement:', PHP_EOL; $a = 5; var_dump($a--); var_dump($a); echo 'Pre-decrement:', PHP_EOL; $a = 5; var_dump(--$a); var_dump($a); ?>
php
MIT
5d244a4b7a9b484581edbb5df596a4e76ba17fa6
2026-01-05T04:31:39.990954Z
false
lkrms/pretty-php
https://github.com/lkrms/pretty-php/blob/5d244a4b7a9b484581edbb5df596a4e76ba17fa6/tests/fixtures/Formatter/in/3rdparty/php-doc/language/operators/array/001.php
tests/fixtures/Formatter/in/3rdparty/php-doc/language/operators/array/001.php
<?php $a = array("apple", "banana"); $b = array(1 => "banana", "0" => "apple"); var_dump($a == $b); // bool(true) var_dump($a === $b); // bool(false) ?>
php
MIT
5d244a4b7a9b484581edbb5df596a4e76ba17fa6
2026-01-05T04:31:39.990954Z
false
lkrms/pretty-php
https://github.com/lkrms/pretty-php/blob/5d244a4b7a9b484581edbb5df596a4e76ba17fa6/tests/fixtures/Formatter/in/3rdparty/php-doc/language/operators/array/000.php
tests/fixtures/Formatter/in/3rdparty/php-doc/language/operators/array/000.php
<?php $a = array("a" => "apple", "b" => "banana"); $b = array("a" => "pear", "b" => "strawberry", "c" => "cherry"); $c = $a + $b; // Union of $a and $b echo "Union of \$a and \$b: \n"; var_dump($c); $c = $b + $a; // Union of $b and $a echo "Union of \$b and \$a: \n"; var_dump($c); $a += $b; // Union of $a += $b is $...
php
MIT
5d244a4b7a9b484581edbb5df596a4e76ba17fa6
2026-01-05T04:31:39.990954Z
false
lkrms/pretty-php
https://github.com/lkrms/pretty-php/blob/5d244a4b7a9b484581edbb5df596a4e76ba17fa6/tests/fixtures/Formatter/in/3rdparty/php-doc/language/operators/precedence/004.php
tests/fixtures/Formatter/in/3rdparty/php-doc/language/operators/precedence/004.php
<?php $x = 4; // this line might result in unexpected output: echo "x minus one equals " . $x-1 . ", or so I hope\n"; // because it is evaluated like this line (prior to PHP 8.0.0): echo (("x minus one equals " . $x) - 1) . ", or so I hope\n"; // the desired precedence can be enforced by using parentheses: echo "x mi...
php
MIT
5d244a4b7a9b484581edbb5df596a4e76ba17fa6
2026-01-05T04:31:39.990954Z
false
lkrms/pretty-php
https://github.com/lkrms/pretty-php/blob/5d244a4b7a9b484581edbb5df596a4e76ba17fa6/tests/fixtures/Formatter/in/3rdparty/php-doc/language/operators/precedence/001.php
tests/fixtures/Formatter/in/3rdparty/php-doc/language/operators/precedence/001.php
<?php $a = true ? 0 : (true ? 1 : 2); var_dump($a); // this is not allowed since PHP 8 // $a = true ? 0 : true ? 1 : 2; ?>
php
MIT
5d244a4b7a9b484581edbb5df596a4e76ba17fa6
2026-01-05T04:31:39.990954Z
false
lkrms/pretty-php
https://github.com/lkrms/pretty-php/blob/5d244a4b7a9b484581edbb5df596a4e76ba17fa6/tests/fixtures/Formatter/in/3rdparty/php-doc/language/operators/precedence/002.php
tests/fixtures/Formatter/in/3rdparty/php-doc/language/operators/precedence/002.php
<?php $a = 1; echo $a + $a++; // may print either 2 or 3 $i = 1; $array[$i] = $i++; // may set either index 1 or 2 ?>
php
MIT
5d244a4b7a9b484581edbb5df596a4e76ba17fa6
2026-01-05T04:31:39.990954Z
false
lkrms/pretty-php
https://github.com/lkrms/pretty-php/blob/5d244a4b7a9b484581edbb5df596a4e76ba17fa6/tests/fixtures/Formatter/in/3rdparty/php-doc/language/operators/precedence/003.php
tests/fixtures/Formatter/in/3rdparty/php-doc/language/operators/precedence/003.php
<?php $x = 4; // this line might result in unexpected output: echo "x minus one equals " . $x-1 . ", or so I hope\n"; // the desired precedence can be enforced by using parentheses: echo "x minus one equals " . ($x-1) . ", or so I hope\n"; // this is not allowed, and throws a TypeError: echo (("x minus one equals " ....
php
MIT
5d244a4b7a9b484581edbb5df596a4e76ba17fa6
2026-01-05T04:31:39.990954Z
false
lkrms/pretty-php
https://github.com/lkrms/pretty-php/blob/5d244a4b7a9b484581edbb5df596a4e76ba17fa6/tests/fixtures/Formatter/in/3rdparty/php-doc/language/operators/precedence/000.php
tests/fixtures/Formatter/in/3rdparty/php-doc/language/operators/precedence/000.php
<?php $a = 3 * 3 % 5; // (3 * 3) % 5 = 4 var_dump($a); $a = 1; $b = 2; $a = $b += 3; // $a = ($b += 3) -> $a = 5, $b = 5 var_dump($a, $b); ?>
php
MIT
5d244a4b7a9b484581edbb5df596a4e76ba17fa6
2026-01-05T04:31:39.990954Z
false
lkrms/pretty-php
https://github.com/lkrms/pretty-php/blob/5d244a4b7a9b484581edbb5df596a4e76ba17fa6/tests/fixtures/Formatter/in/3rdparty/php-doc/language/operators/functional/001.php
tests/fixtures/Formatter/in/3rdparty/php-doc/language/operators/functional/001.php
<?php $result = "PHP Rocks" |> htmlentities(...) |> str_split(...) |> (fn($x) => array_map(strtoupper(...), $x)) |> (fn($x) => array_filter($x, fn($v) => $v != 'O')) ; print_r($result); $temp = "PHP Rocks"; $temp = htmlentities($temp); $temp = str_split($temp); $temp = array_map(strtoupper(...), $temp)...
php
MIT
5d244a4b7a9b484581edbb5df596a4e76ba17fa6
2026-01-05T04:31:39.990954Z
false
lkrms/pretty-php
https://github.com/lkrms/pretty-php/blob/5d244a4b7a9b484581edbb5df596a4e76ba17fa6/tests/fixtures/Formatter/in/3rdparty/php-doc/language/operators/functional/000.php
tests/fixtures/Formatter/in/3rdparty/php-doc/language/operators/functional/000.php
<?php $result = "Hello World" |> strlen(...); echo $result, PHP_EOL; $result = strlen("Hello World"); echo $result, PHP_EOL; ?>
php
MIT
5d244a4b7a9b484581edbb5df596a4e76ba17fa6
2026-01-05T04:31:39.990954Z
false
lkrms/pretty-php
https://github.com/lkrms/pretty-php/blob/5d244a4b7a9b484581edbb5df596a4e76ba17fa6/tests/fixtures/Formatter/in/3rdparty/php-doc/language/types/000.php
tests/fixtures/Formatter/in/3rdparty/php-doc/language/types/000.php
<?php $a_bool = true; // a bool $a_str = "foo"; // a string $a_str2 = 'foo'; // a string $an_int = 12; // an int echo get_debug_type($a_bool), "\n"; echo get_debug_type($a_str), "\n"; // If this is an integer, increment it by four if (is_int($an_int)) { $an_int += 4; } var_dump($an_int); // If $a_bool i...
php
MIT
5d244a4b7a9b484581edbb5df596a4e76ba17fa6
2026-01-05T04:31:39.990954Z
false
lkrms/pretty-php
https://github.com/lkrms/pretty-php/blob/5d244a4b7a9b484581edbb5df596a4e76ba17fa6/tests/fixtures/Formatter/in/3rdparty/php-doc/language/types/string/018.php
tests/fixtures/Formatter/in/3rdparty/php-doc/language/types/string/018.php
<?php $juices = array("apple", "orange", "string_key" => "purple"); echo "He drank some $juices[0] juice."; echo PHP_EOL; echo "He drank some $juices[1] juice."; echo PHP_EOL; echo "He drank some $juices[string_key] juice."; echo PHP_EOL; class A { public $s = "string"; } $o = new A(); echo "Object value: $o->s...
php
MIT
5d244a4b7a9b484581edbb5df596a4e76ba17fa6
2026-01-05T04:31:39.990954Z
false
lkrms/pretty-php
https://github.com/lkrms/pretty-php/blob/5d244a4b7a9b484581edbb5df596a4e76ba17fa6/tests/fixtures/Formatter/in/3rdparty/php-doc/language/types/string/017.php
tests/fixtures/Formatter/in/3rdparty/php-doc/language/types/string/017.php
<?php echo "No interpolation $ has happened\n"; echo "No interpolation $\n has happened\n"; echo "No interpolation $2 has happened\n"; ?>
php
MIT
5d244a4b7a9b484581edbb5df596a4e76ba17fa6
2026-01-05T04:31:39.990954Z
false
lkrms/pretty-php
https://github.com/lkrms/pretty-php/blob/5d244a4b7a9b484581edbb5df596a4e76ba17fa6/tests/fixtures/Formatter/in/3rdparty/php-doc/language/types/string/013.php
tests/fixtures/Formatter/in/3rdparty/php-doc/language/types/string/013.php
<?php class foo { public $foo; public $bar; function __construct() { $this->foo = 'Foo'; $this->bar = array('Bar1', 'Bar2', 'Bar3'); } } $foo = new foo(); $name = 'MyName'; echo <<<'EOT' My name is "$name". I am printing some $foo->foo. Now, I am printing some {$foo->bar[1]}. This...
php
MIT
5d244a4b7a9b484581edbb5df596a4e76ba17fa6
2026-01-05T04:31:39.990954Z
false
lkrms/pretty-php
https://github.com/lkrms/pretty-php/blob/5d244a4b7a9b484581edbb5df596a4e76ba17fa6/tests/fixtures/Formatter/in/3rdparty/php-doc/language/types/string/004.php
tests/fixtures/Formatter/in/3rdparty/php-doc/language/types/string/004.php
<?php $values = [<<<END a b c END, 'd e f']; var_dump($values);
php
MIT
5d244a4b7a9b484581edbb5df596a4e76ba17fa6
2026-01-05T04:31:39.990954Z
false
lkrms/pretty-php
https://github.com/lkrms/pretty-php/blob/5d244a4b7a9b484581edbb5df596a4e76ba17fa6/tests/fixtures/Formatter/in/3rdparty/php-doc/language/types/string/022.php
tests/fixtures/Formatter/in/3rdparty/php-doc/language/types/string/022.php
<?php $str = 'abc'; $keys = [ '1', '1.0', 'x', '1x' ]; foreach ($keys as $keyToTry) { var_dump(isset($str[$keyToTry])); try { var_dump($str[$keyToTry]); } catch (TypeError $e) { echo $e->getMessage(), PHP_EOL; } echo PHP_EOL; } ?>
php
MIT
5d244a4b7a9b484581edbb5df596a4e76ba17fa6
2026-01-05T04:31:39.990954Z
false
lkrms/pretty-php
https://github.com/lkrms/pretty-php/blob/5d244a4b7a9b484581edbb5df596a4e76ba17fa6/tests/fixtures/Formatter/in/3rdparty/php-doc/language/types/string/016.php
tests/fixtures/Formatter/in/3rdparty/php-doc/language/types/string/016.php
<?php const foo = 'bar'; $foo = 'foo'; $bar = 'bar'; var_dump("${foo}"); var_dump("${(foo)}"); ?>
php
MIT
5d244a4b7a9b484581edbb5df596a4e76ba17fa6
2026-01-05T04:31:39.990954Z
false
lkrms/pretty-php
https://github.com/lkrms/pretty-php/blob/5d244a4b7a9b484581edbb5df596a4e76ba17fa6/tests/fixtures/Formatter/in/3rdparty/php-doc/language/types/string/001.php
tests/fixtures/Formatter/in/3rdparty/php-doc/language/types/string/001.php
<?php // no indentation echo <<<END a b c \n END; // 4 spaces of indentation echo <<<END a b c END;
php
MIT
5d244a4b7a9b484581edbb5df596a4e76ba17fa6
2026-01-05T04:31:39.990954Z
false
lkrms/pretty-php
https://github.com/lkrms/pretty-php/blob/5d244a4b7a9b484581edbb5df596a4e76ba17fa6/tests/fixtures/Formatter/in/3rdparty/php-doc/language/types/string/011.php
tests/fixtures/Formatter/in/3rdparty/php-doc/language/types/string/011.php
<?php echo <<<"FOOBAR" Hello World! FOOBAR; ?>
php
MIT
5d244a4b7a9b484581edbb5df596a4e76ba17fa6
2026-01-05T04:31:39.990954Z
false
lkrms/pretty-php
https://github.com/lkrms/pretty-php/blob/5d244a4b7a9b484581edbb5df596a4e76ba17fa6/tests/fixtures/Formatter/in/3rdparty/php-doc/language/types/string/009.php
tests/fixtures/Formatter/in/3rdparty/php-doc/language/types/string/009.php
<?php var_dump(array(<<<EOD foobar! EOD )); ?>
php
MIT
5d244a4b7a9b484581edbb5df596a4e76ba17fa6
2026-01-05T04:31:39.990954Z
false
lkrms/pretty-php
https://github.com/lkrms/pretty-php/blob/5d244a4b7a9b484581edbb5df596a4e76ba17fa6/tests/fixtures/Formatter/in/3rdparty/php-doc/language/types/string/020.php
tests/fixtures/Formatter/in/3rdparty/php-doc/language/types/string/020.php
<?php const DATA_KEY = 'const-key'; $great = 'fantastic'; $arr = [ '1', '2', '3', [41, 42, 43], 'key' => 'Indexed value', 'const-key' => 'Key with minus sign', 'foo' => ['foo1', 'foo2', 'foo3'] ]; // Won't work, outputs: This is { fantastic} echo "This is { $great}"; // Works, outputs: Thi...
php
MIT
5d244a4b7a9b484581edbb5df596a4e76ba17fa6
2026-01-05T04:31:39.990954Z
false
lkrms/pretty-php
https://github.com/lkrms/pretty-php/blob/5d244a4b7a9b484581edbb5df596a4e76ba17fa6/tests/fixtures/Formatter/in/3rdparty/php-doc/language/types/string/012.php
tests/fixtures/Formatter/in/3rdparty/php-doc/language/types/string/012.php
<?php echo <<<'EOD' Example of string spanning multiple lines using nowdoc syntax. Backslashes are always treated literally, e.g. \\ and \'. EOD;
php
MIT
5d244a4b7a9b484581edbb5df596a4e76ba17fa6
2026-01-05T04:31:39.990954Z
false
lkrms/pretty-php
https://github.com/lkrms/pretty-php/blob/5d244a4b7a9b484581edbb5df596a4e76ba17fa6/tests/fixtures/Formatter/in/3rdparty/php-doc/language/types/string/019.php
tests/fixtures/Formatter/in/3rdparty/php-doc/language/types/string/019.php
<?php $string = 'string'; echo "The character at index -2 is $string[-2].", PHP_EOL; $string[-3] = 'o'; echo "Changing the character at index -3 to o gives $string.", PHP_EOL; ?>
php
MIT
5d244a4b7a9b484581edbb5df596a4e76ba17fa6
2026-01-05T04:31:39.990954Z
false
lkrms/pretty-php
https://github.com/lkrms/pretty-php/blob/5d244a4b7a9b484581edbb5df596a4e76ba17fa6/tests/fixtures/Formatter/in/3rdparty/php-doc/language/types/string/014.php
tests/fixtures/Formatter/in/3rdparty/php-doc/language/types/string/014.php
<?php class foo { public $bar = <<<'EOT' bar EOT; } ?>
php
MIT
5d244a4b7a9b484581edbb5df596a4e76ba17fa6
2026-01-05T04:31:39.990954Z
false
lkrms/pretty-php
https://github.com/lkrms/pretty-php/blob/5d244a4b7a9b484581edbb5df596a4e76ba17fa6/tests/fixtures/Formatter/in/3rdparty/php-doc/language/types/string/015.php
tests/fixtures/Formatter/in/3rdparty/php-doc/language/types/string/015.php
<?php $juice = "apple"; echo "He drank some $juice juice." . PHP_EOL; ?>
php
MIT
5d244a4b7a9b484581edbb5df596a4e76ba17fa6
2026-01-05T04:31:39.990954Z
false
lkrms/pretty-php
https://github.com/lkrms/pretty-php/blob/5d244a4b7a9b484581edbb5df596a4e76ba17fa6/tests/fixtures/Formatter/in/3rdparty/php-doc/language/types/string/007.php
tests/fixtures/Formatter/in/3rdparty/php-doc/language/types/string/007.php
<?php class foo { public $bar = <<<EOT bar EOT; } ?>
php
MIT
5d244a4b7a9b484581edbb5df596a4e76ba17fa6
2026-01-05T04:31:39.990954Z
false
lkrms/pretty-php
https://github.com/lkrms/pretty-php/blob/5d244a4b7a9b484581edbb5df596a4e76ba17fa6/tests/fixtures/Formatter/in/3rdparty/php-doc/language/types/string/010.php
tests/fixtures/Formatter/in/3rdparty/php-doc/language/types/string/010.php
<?php // Static variables function foo() { static $bar = <<<LABEL Nothing in here... LABEL; } // Class properties/constants class foo { const BAR = <<<FOOBAR Constant example FOOBAR; public $baz = <<<FOOBAR Property example FOOBAR; } ?>
php
MIT
5d244a4b7a9b484581edbb5df596a4e76ba17fa6
2026-01-05T04:31:39.990954Z
false
lkrms/pretty-php
https://github.com/lkrms/pretty-php/blob/5d244a4b7a9b484581edbb5df596a4e76ba17fa6/tests/fixtures/Formatter/in/3rdparty/php-doc/language/types/string/008.php
tests/fixtures/Formatter/in/3rdparty/php-doc/language/types/string/008.php
<?php $str = <<<EOD Example of string spanning multiple lines using heredoc syntax. EOD; /* More complex example, with variables. */ class foo { var $foo; var $bar; function __construct() { $this->foo = 'Foo'; $this->bar = array('Bar1', 'Bar2', 'Bar3'); } } $foo = new foo(); $name...
php
MIT
5d244a4b7a9b484581edbb5df596a4e76ba17fa6
2026-01-05T04:31:39.990954Z
false
lkrms/pretty-php
https://github.com/lkrms/pretty-php/blob/5d244a4b7a9b484581edbb5df596a4e76ba17fa6/tests/fixtures/Formatter/in/3rdparty/php-doc/language/types/string/000.php
tests/fixtures/Formatter/in/3rdparty/php-doc/language/types/string/000.php
<?php echo 'this is a simple string', PHP_EOL; echo 'You can also have embedded newlines in strings this way as it is okay to do', PHP_EOL; // Outputs: Arnold once said: "I'll be back" echo 'Arnold once said: "I\'ll be back"', PHP_EOL; // Outputs: You deleted C:\*.*? echo 'You deleted C:\\*.*?', PHP_EOL; // Outputs...
php
MIT
5d244a4b7a9b484581edbb5df596a4e76ba17fa6
2026-01-05T04:31:39.990954Z
false
lkrms/pretty-php
https://github.com/lkrms/pretty-php/blob/5d244a4b7a9b484581edbb5df596a4e76ba17fa6/tests/fixtures/Formatter/in/3rdparty/php-doc/language/types/string/021.php
tests/fixtures/Formatter/in/3rdparty/php-doc/language/types/string/021.php
<?php // Get the first character of a string $str = 'This is a test.'; $first = $str[0]; var_dump($first); // Get the third character of a string $third = $str[2]; var_dump($third); // Get the last character of a string. $str = 'This is still a test.'; $last = $str[strlen($str)-1]; var_dump($last); // Modify the las...
php
MIT
5d244a4b7a9b484581edbb5df596a4e76ba17fa6
2026-01-05T04:31:39.990954Z
false
lkrms/pretty-php
https://github.com/lkrms/pretty-php/blob/5d244a4b7a9b484581edbb5df596a4e76ba17fa6/tests/fixtures/Formatter/in/3rdparty/php-doc/language/types/enumerations/000.php
tests/fixtures/Formatter/in/3rdparty/php-doc/language/types/enumerations/000.php
<?php enum Suit { case Hearts; case Diamonds; case Clubs; case Spades; } function do_stuff(Suit $s) { // ... } do_stuff(Suit::Spades); ?>
php
MIT
5d244a4b7a9b484581edbb5df596a4e76ba17fa6
2026-01-05T04:31:39.990954Z
false
lkrms/pretty-php
https://github.com/lkrms/pretty-php/blob/5d244a4b7a9b484581edbb5df596a4e76ba17fa6/tests/fixtures/Formatter/in/3rdparty/php-doc/language/types/float/001.php
tests/fixtures/Formatter/in/3rdparty/php-doc/language/types/float/001.php
<?php $a = 1.23456789; $b = 1.23456780; $epsilon = 0.00001; if (abs($a - $b) < $epsilon) { echo "true"; } ?>
php
MIT
5d244a4b7a9b484581edbb5df596a4e76ba17fa6
2026-01-05T04:31:39.990954Z
false
lkrms/pretty-php
https://github.com/lkrms/pretty-php/blob/5d244a4b7a9b484581edbb5df596a4e76ba17fa6/tests/fixtures/Formatter/in/3rdparty/php-doc/language/types/float/000.php
tests/fixtures/Formatter/in/3rdparty/php-doc/language/types/float/000.php
<?php $a = 1.234; $b = 1.2e3; $c = 7E-10; $d = 1_234.567; // as of PHP 7.4.0 ?>
php
MIT
5d244a4b7a9b484581edbb5df596a4e76ba17fa6
2026-01-05T04:31:39.990954Z
false
lkrms/pretty-php
https://github.com/lkrms/pretty-php/blob/5d244a4b7a9b484581edbb5df596a4e76ba17fa6/tests/fixtures/Formatter/in/3rdparty/php-doc/language/types/integer/004.php
tests/fixtures/Formatter/in/3rdparty/php-doc/language/types/integer/004.php
<?php echo (int) ( (0.1+0.7) * 10 ); // echoes 7! ?>
php
MIT
5d244a4b7a9b484581edbb5df596a4e76ba17fa6
2026-01-05T04:31:39.990954Z
false
lkrms/pretty-php
https://github.com/lkrms/pretty-php/blob/5d244a4b7a9b484581edbb5df596a4e76ba17fa6/tests/fixtures/Formatter/in/3rdparty/php-doc/language/types/integer/001.php
tests/fixtures/Formatter/in/3rdparty/php-doc/language/types/integer/001.php
<?php $large_number = 50000000000000000000; var_dump($large_number); // float(5.0E+19) var_dump(PHP_INT_MAX + 1); // 32-bit system: float(2147483648) // 64-bit system: float(9.2233720368548E+18) ?>
php
MIT
5d244a4b7a9b484581edbb5df596a4e76ba17fa6
2026-01-05T04:31:39.990954Z
false
lkrms/pretty-php
https://github.com/lkrms/pretty-php/blob/5d244a4b7a9b484581edbb5df596a4e76ba17fa6/tests/fixtures/Formatter/in/3rdparty/php-doc/language/types/integer/002.php
tests/fixtures/Formatter/in/3rdparty/php-doc/language/types/integer/002.php
<?php var_dump(25/7); // float(3.5714285714286) var_dump((int) (25/7)); // int(3) var_dump(round(25/7)); // float(4) ?>
php
MIT
5d244a4b7a9b484581edbb5df596a4e76ba17fa6
2026-01-05T04:31:39.990954Z
false
lkrms/pretty-php
https://github.com/lkrms/pretty-php/blob/5d244a4b7a9b484581edbb5df596a4e76ba17fa6/tests/fixtures/Formatter/in/3rdparty/php-doc/language/types/integer/003.php
tests/fixtures/Formatter/in/3rdparty/php-doc/language/types/integer/003.php
<?php function foo($value): int { return $value; } var_dump(foo(8.1)); // "Deprecated: Implicit conversion from float 8.1 to int loses precision" as of PHP 8.1.0 var_dump(foo(8.1)); // 8 prior to PHP 8.1.0 var_dump(foo(8.0)); // 8 in both cases var_dump((int) 8.1); // 8 in both cases var_dump(intval(8.1)); // 8 in...
php
MIT
5d244a4b7a9b484581edbb5df596a4e76ba17fa6
2026-01-05T04:31:39.990954Z
false
lkrms/pretty-php
https://github.com/lkrms/pretty-php/blob/5d244a4b7a9b484581edbb5df596a4e76ba17fa6/tests/fixtures/Formatter/in/3rdparty/php-doc/language/types/integer/000.php
tests/fixtures/Formatter/in/3rdparty/php-doc/language/types/integer/000.php
<?php $a = 1234; // decimal number $a = 0123; // octal number (equivalent to 83 decimal) $a = 0o123; // octal number (as of PHP 8.1.0) $a = 0x1A; // hexadecimal number (equivalent to 26 decimal) $a = 0b11111111; // binary number (equivalent to 255 decimal) $a = 1_234_567; // decimal number (as of PHP 7.4.0) ?>
php
MIT
5d244a4b7a9b484581edbb5df596a4e76ba17fa6
2026-01-05T04:31:39.990954Z
false
lkrms/pretty-php
https://github.com/lkrms/pretty-php/blob/5d244a4b7a9b484581edbb5df596a4e76ba17fa6/tests/fixtures/Formatter/in/3rdparty/php-doc/language/types/boolean/001.php
tests/fixtures/Formatter/in/3rdparty/php-doc/language/types/boolean/001.php
<?php $action = "show_version"; $show_separators = true; // == is an operator which tests // equality and returns a boolean if ($action == "show_version") { echo "The version is 1.23"; } // this is not necessary... if ($show_separators == TRUE) { echo "<hr>\n"; } // ...because this can be used with exactly t...
php
MIT
5d244a4b7a9b484581edbb5df596a4e76ba17fa6
2026-01-05T04:31:39.990954Z
false
lkrms/pretty-php
https://github.com/lkrms/pretty-php/blob/5d244a4b7a9b484581edbb5df596a4e76ba17fa6/tests/fixtures/Formatter/in/3rdparty/php-doc/language/types/boolean/002.php
tests/fixtures/Formatter/in/3rdparty/php-doc/language/types/boolean/002.php
<?php var_dump((bool) ""); // bool(false) var_dump((bool) "0"); // bool(false) var_dump((bool) 1); // bool(true) var_dump((bool) -2); // bool(true) var_dump((bool) "foo"); // bool(true) var_dump((bool) 2.3e5); // bool(true) var_dump((bool) array(12)); // bool(true) var_dump((bool) ar...
php
MIT
5d244a4b7a9b484581edbb5df596a4e76ba17fa6
2026-01-05T04:31:39.990954Z
false
lkrms/pretty-php
https://github.com/lkrms/pretty-php/blob/5d244a4b7a9b484581edbb5df596a4e76ba17fa6/tests/fixtures/Formatter/in/3rdparty/php-doc/language/types/boolean/000.php
tests/fixtures/Formatter/in/3rdparty/php-doc/language/types/boolean/000.php
<?php $foo = True; // assign the value TRUE to $foo ?>
php
MIT
5d244a4b7a9b484581edbb5df596a4e76ba17fa6
2026-01-05T04:31:39.990954Z
false
lkrms/pretty-php
https://github.com/lkrms/pretty-php/blob/5d244a4b7a9b484581edbb5df596a4e76ba17fa6/tests/fixtures/Formatter/in/3rdparty/php-doc/language/types/object/001.php
tests/fixtures/Formatter/in/3rdparty/php-doc/language/types/object/001.php
<?php $obj = (object) array('1' => 'foo'); var_dump(isset($obj->{'1'})); // outputs 'bool(true)' // Deprecated as of PHP 8.1 var_dump(key($obj)); // outputs 'string(1) "1"' ?>
php
MIT
5d244a4b7a9b484581edbb5df596a4e76ba17fa6
2026-01-05T04:31:39.990954Z
false
lkrms/pretty-php
https://github.com/lkrms/pretty-php/blob/5d244a4b7a9b484581edbb5df596a4e76ba17fa6/tests/fixtures/Formatter/in/3rdparty/php-doc/language/types/object/002.php
tests/fixtures/Formatter/in/3rdparty/php-doc/language/types/object/002.php
<?php $obj = (object) 'ciao'; echo $obj->scalar; // outputs 'ciao' ?>
php
MIT
5d244a4b7a9b484581edbb5df596a4e76ba17fa6
2026-01-05T04:31:39.990954Z
false
lkrms/pretty-php
https://github.com/lkrms/pretty-php/blob/5d244a4b7a9b484581edbb5df596a4e76ba17fa6/tests/fixtures/Formatter/in/3rdparty/php-doc/language/types/object/000.php
tests/fixtures/Formatter/in/3rdparty/php-doc/language/types/object/000.php
<?php class foo { function do_foo() { echo "Doing foo."; } } $bar = new foo; $bar->do_foo(); ?>
php
MIT
5d244a4b7a9b484581edbb5df596a4e76ba17fa6
2026-01-05T04:31:39.990954Z
false
lkrms/pretty-php
https://github.com/lkrms/pretty-php/blob/5d244a4b7a9b484581edbb5df596a4e76ba17fa6/tests/fixtures/Formatter/in/3rdparty/php-doc/language/types/declarations/006.php
tests/fixtures/Formatter/in/3rdparty/php-doc/language/types/declarations/006.php
<?php interface I { public function f(); } class C implements I { public function f() {} } // This doesn't implement I. class E {} function f(I $i) { echo get_class($i)."\n"; } f(new C); f(new E); ?>
php
MIT
5d244a4b7a9b484581edbb5df596a4e76ba17fa6
2026-01-05T04:31:39.990954Z
false
lkrms/pretty-php
https://github.com/lkrms/pretty-php/blob/5d244a4b7a9b484581edbb5df596a4e76ba17fa6/tests/fixtures/Formatter/in/3rdparty/php-doc/language/types/declarations/013.php
tests/fixtures/Formatter/in/3rdparty/php-doc/language/types/declarations/013.php
<?php function sum(int $a, int $b) { return $a + $b; } var_dump(sum(1, 2)); // These will be coerced to integers: note the output below! var_dump(sum(1.5, 2.5)); ?>
php
MIT
5d244a4b7a9b484581edbb5df596a4e76ba17fa6
2026-01-05T04:31:39.990954Z
false
lkrms/pretty-php
https://github.com/lkrms/pretty-php/blob/5d244a4b7a9b484581edbb5df596a4e76ba17fa6/tests/fixtures/Formatter/in/3rdparty/php-doc/language/types/declarations/004.php
tests/fixtures/Formatter/in/3rdparty/php-doc/language/types/declarations/004.php
<?php function foo(): int|INT {} // Disallowed function foo(): bool|false {} // Disallowed function foo(): int&Traversable {} // Disallowed function foo(): self&Traversable {} // Disallowed use A as B; function foo(): A|B {} // Disallowed ("use" is part of name resolution) function foo(): A&B {} // Disallowed ("use" i...
php
MIT
5d244a4b7a9b484581edbb5df596a4e76ba17fa6
2026-01-05T04:31:39.990954Z
false
lkrms/pretty-php
https://github.com/lkrms/pretty-php/blob/5d244a4b7a9b484581edbb5df596a4e76ba17fa6/tests/fixtures/Formatter/in/3rdparty/php-doc/language/types/declarations/001.php
tests/fixtures/Formatter/in/3rdparty/php-doc/language/types/declarations/001.php
<?php function &test(): void {} ?>
php
MIT
5d244a4b7a9b484581edbb5df596a4e76ba17fa6
2026-01-05T04:31:39.990954Z
false
lkrms/pretty-php
https://github.com/lkrms/pretty-php/blob/5d244a4b7a9b484581edbb5df596a4e76ba17fa6/tests/fixtures/Formatter/in/3rdparty/php-doc/language/types/declarations/002.php
tests/fixtures/Formatter/in/3rdparty/php-doc/language/types/declarations/002.php
<?php function array_baz(array &$param) { $param = 1; } $var = []; array_baz($var); var_dump($var); array_baz($var); ?>
php
MIT
5d244a4b7a9b484581edbb5df596a4e76ba17fa6
2026-01-05T04:31:39.990954Z
false
lkrms/pretty-php
https://github.com/lkrms/pretty-php/blob/5d244a4b7a9b484581edbb5df596a4e76ba17fa6/tests/fixtures/Formatter/in/3rdparty/php-doc/language/types/declarations/011.php
tests/fixtures/Formatter/in/3rdparty/php-doc/language/types/declarations/011.php
<?php class User { public static string $foo = 'foo'; public int $id; public string $username; public function __construct(int $id, string $username) { $this->id = $id; $this->username = $username; } } ?>
php
MIT
5d244a4b7a9b484581edbb5df596a4e76ba17fa6
2026-01-05T04:31:39.990954Z
false
lkrms/pretty-php
https://github.com/lkrms/pretty-php/blob/5d244a4b7a9b484581edbb5df596a4e76ba17fa6/tests/fixtures/Formatter/in/3rdparty/php-doc/language/types/declarations/009.php
tests/fixtures/Formatter/in/3rdparty/php-doc/language/types/declarations/009.php
<?php class C {} function f(?C $c) { var_dump($c); } f(new C); f(null); ?>
php
MIT
5d244a4b7a9b484581edbb5df596a4e76ba17fa6
2026-01-05T04:31:39.990954Z
false
lkrms/pretty-php
https://github.com/lkrms/pretty-php/blob/5d244a4b7a9b484581edbb5df596a4e76ba17fa6/tests/fixtures/Formatter/in/3rdparty/php-doc/language/types/declarations/012.php
tests/fixtures/Formatter/in/3rdparty/php-doc/language/types/declarations/012.php
<?php declare(strict_types=1); function sum(int $a, int $b) { return $a + $b; } var_dump(sum(1, 2)); var_dump(sum(1.5, 2.5)); ?>
php
MIT
5d244a4b7a9b484581edbb5df596a4e76ba17fa6
2026-01-05T04:31:39.990954Z
false
lkrms/pretty-php
https://github.com/lkrms/pretty-php/blob/5d244a4b7a9b484581edbb5df596a4e76ba17fa6/tests/fixtures/Formatter/in/3rdparty/php-doc/language/types/declarations/014.php
tests/fixtures/Formatter/in/3rdparty/php-doc/language/types/declarations/014.php
<?php declare(strict_types=1); function sum($a, $b): int { return $a + $b; } var_dump(sum(1, 2)); var_dump(sum(1, 2.5)); ?>
php
MIT
5d244a4b7a9b484581edbb5df596a4e76ba17fa6
2026-01-05T04:31:39.990954Z
false
lkrms/pretty-php
https://github.com/lkrms/pretty-php/blob/5d244a4b7a9b484581edbb5df596a4e76ba17fa6/tests/fixtures/Formatter/in/3rdparty/php-doc/language/types/declarations/007.php
tests/fixtures/Formatter/in/3rdparty/php-doc/language/types/declarations/007.php
<?php function sum($a, $b): float { return $a + $b; } // Note that a float will be returned. var_dump(sum(1, 2)); ?>
php
MIT
5d244a4b7a9b484581edbb5df596a4e76ba17fa6
2026-01-05T04:31:39.990954Z
false
lkrms/pretty-php
https://github.com/lkrms/pretty-php/blob/5d244a4b7a9b484581edbb5df596a4e76ba17fa6/tests/fixtures/Formatter/in/3rdparty/php-doc/language/types/declarations/010.php
tests/fixtures/Formatter/in/3rdparty/php-doc/language/types/declarations/010.php
<?php function get_item(): ?string { if (isset($_GET['item'])) { return $_GET['item']; } else { return null; } } ?>
php
MIT
5d244a4b7a9b484581edbb5df596a4e76ba17fa6
2026-01-05T04:31:39.990954Z
false
lkrms/pretty-php
https://github.com/lkrms/pretty-php/blob/5d244a4b7a9b484581edbb5df596a4e76ba17fa6/tests/fixtures/Formatter/in/3rdparty/php-doc/language/types/declarations/003.php
tests/fixtures/Formatter/in/3rdparty/php-doc/language/types/declarations/003.php
<?php class C {} function f(C $c = null) { var_dump($c); } f(new C); f(null); ?>
php
MIT
5d244a4b7a9b484581edbb5df596a4e76ba17fa6
2026-01-05T04:31:39.990954Z
false
lkrms/pretty-php
https://github.com/lkrms/pretty-php/blob/5d244a4b7a9b484581edbb5df596a4e76ba17fa6/tests/fixtures/Formatter/in/3rdparty/php-doc/language/types/declarations/008.php
tests/fixtures/Formatter/in/3rdparty/php-doc/language/types/declarations/008.php
<?php class C {} function getC(): C { return new C; } var_dump(getC()); ?>
php
MIT
5d244a4b7a9b484581edbb5df596a4e76ba17fa6
2026-01-05T04:31:39.990954Z
false
lkrms/pretty-php
https://github.com/lkrms/pretty-php/blob/5d244a4b7a9b484581edbb5df596a4e76ba17fa6/tests/fixtures/Formatter/in/3rdparty/php-doc/language/types/declarations/000.php
tests/fixtures/Formatter/in/3rdparty/php-doc/language/types/declarations/000.php
<?php function test(boolean $param) {} test(true); ?>
php
MIT
5d244a4b7a9b484581edbb5df596a4e76ba17fa6
2026-01-05T04:31:39.990954Z
false
lkrms/pretty-php
https://github.com/lkrms/pretty-php/blob/5d244a4b7a9b484581edbb5df596a4e76ba17fa6/tests/fixtures/Formatter/in/3rdparty/php-doc/language/types/declarations/005.php
tests/fixtures/Formatter/in/3rdparty/php-doc/language/types/declarations/005.php
<?php class C {} class D extends C {} // This doesn't extend C. class E {} function f(C $c) { echo get_class($c)."\n"; } f(new C); f(new D); f(new E); ?>
php
MIT
5d244a4b7a9b484581edbb5df596a4e76ba17fa6
2026-01-05T04:31:39.990954Z
false
lkrms/pretty-php
https://github.com/lkrms/pretty-php/blob/5d244a4b7a9b484581edbb5df596a4e76ba17fa6/tests/fixtures/Formatter/in/3rdparty/php-doc/language/types/numeric-strings/001.php
tests/fixtures/Formatter/in/3rdparty/php-doc/language/types/numeric-strings/001.php
<?php $foo = 1 + "10.5"; // $foo is float (11.5) $foo = 1 + "-1.3e3"; // $foo is float (-1299) $foo = 1 + "bob-1.3e3"; // TypeError as of PHP 8.0.0, $foo is integer (1) previously $foo = 1 + "bob3"; // TypeError as of PHP 8.0.0, $foo is integer (1) previously $foo = ...
php
MIT
5d244a4b7a9b484581edbb5df596a4e76ba17fa6
2026-01-05T04:31:39.990954Z
false
lkrms/pretty-php
https://github.com/lkrms/pretty-php/blob/5d244a4b7a9b484581edbb5df596a4e76ba17fa6/tests/fixtures/Formatter/in/3rdparty/php-doc/language/types/numeric-strings/000.php
tests/fixtures/Formatter/in/3rdparty/php-doc/language/types/numeric-strings/000.php
<?php var_dump("0D1" == "000"); // false, "0D1" is not scientific notation var_dump("0E1" == "000"); // true, "0E1" is 0 * (10 ^ 1), or 0 var_dump("2E1" == "020"); // true, "2E1" is 2 * (10 ^ 1), or 20 ?>
php
MIT
5d244a4b7a9b484581edbb5df596a4e76ba17fa6
2026-01-05T04:31:39.990954Z
false
lkrms/pretty-php
https://github.com/lkrms/pretty-php/blob/5d244a4b7a9b484581edbb5df596a4e76ba17fa6/tests/fixtures/Formatter/in/3rdparty/php-doc/language/types/null/000.php
tests/fixtures/Formatter/in/3rdparty/php-doc/language/types/null/000.php
<?php $var = NULL; ?>
php
MIT
5d244a4b7a9b484581edbb5df596a4e76ba17fa6
2026-01-05T04:31:39.990954Z
false
lkrms/pretty-php
https://github.com/lkrms/pretty-php/blob/5d244a4b7a9b484581edbb5df596a4e76ba17fa6/tests/fixtures/Formatter/in/3rdparty/php-doc/language/types/array/028.php
tests/fixtures/Formatter/in/3rdparty/php-doc/language/types/array/028.php
<?php $arr1 = [1, 2, 3]; $arr2 = ['a' => 4]; $arr3 = [...$arr1, ...$arr2]; // Fatal error: Uncaught Error: Cannot unpack array with string keys in example.php:5 $arr4 = [1, 2, 3]; $arr5 = [4, 5]; $arr6 = [...$arr4, ...$arr5]; // works. [1, 2, 3, 4, 5] ?>
php
MIT
5d244a4b7a9b484581edbb5df596a4e76ba17fa6
2026-01-05T04:31:39.990954Z
false
lkrms/pretty-php
https://github.com/lkrms/pretty-php/blob/5d244a4b7a9b484581edbb5df596a4e76ba17fa6/tests/fixtures/Formatter/in/3rdparty/php-doc/language/types/array/031.php
tests/fixtures/Formatter/in/3rdparty/php-doc/language/types/array/031.php
<?php $colors = array('red', 'blue', 'green', 'yellow'); foreach ($colors as $color) { echo "Do you like $color?\n"; } ?>
php
MIT
5d244a4b7a9b484581edbb5df596a4e76ba17fa6
2026-01-05T04:31:39.990954Z
false
lkrms/pretty-php
https://github.com/lkrms/pretty-php/blob/5d244a4b7a9b484581edbb5df596a4e76ba17fa6/tests/fixtures/Formatter/in/3rdparty/php-doc/language/types/array/006.php
tests/fixtures/Formatter/in/3rdparty/php-doc/language/types/array/006.php
<?php $array = []; $array[-5] = 1; $array[] = 2; var_dump($array); ?>
php
MIT
5d244a4b7a9b484581edbb5df596a4e76ba17fa6
2026-01-05T04:31:39.990954Z
false
lkrms/pretty-php
https://github.com/lkrms/pretty-php/blob/5d244a4b7a9b484581edbb5df596a4e76ba17fa6/tests/fixtures/Formatter/in/3rdparty/php-doc/language/types/array/018.php
tests/fixtures/Formatter/in/3rdparty/php-doc/language/types/array/018.php
<?php error_reporting(E_ALL); ini_set('display_errors', true); ini_set('html_errors', false); // Simple array: $array = array(1, 2); $count = count($array); for ($i = 0; $i < $count; $i++) { echo "\nChecking $i: \n"; echo "Bad: " . $array['$i'] . "\n"; echo "Good: " . $array[$i] . "\n"; echo "Bad: {$a...
php
MIT
5d244a4b7a9b484581edbb5df596a4e76ba17fa6
2026-01-05T04:31:39.990954Z
false
lkrms/pretty-php
https://github.com/lkrms/pretty-php/blob/5d244a4b7a9b484581edbb5df596a4e76ba17fa6/tests/fixtures/Formatter/in/3rdparty/php-doc/language/types/array/017.php
tests/fixtures/Formatter/in/3rdparty/php-doc/language/types/array/017.php
<?php $foo[bar] = 'enemy'; echo $foo[bar]; // etc ?>
php
MIT
5d244a4b7a9b484581edbb5df596a4e76ba17fa6
2026-01-05T04:31:39.990954Z
false
lkrms/pretty-php
https://github.com/lkrms/pretty-php/blob/5d244a4b7a9b484581edbb5df596a4e76ba17fa6/tests/fixtures/Formatter/in/3rdparty/php-doc/language/types/array/013.php
tests/fixtures/Formatter/in/3rdparty/php-doc/language/types/array/013.php
<?php $source_array = ['foo', 'bar', 'baz']; // Assign the element at index 2 to the variable $baz [, , $baz] = $source_array; echo $baz; // prints "baz" ?>
php
MIT
5d244a4b7a9b484581edbb5df596a4e76ba17fa6
2026-01-05T04:31:39.990954Z
false
lkrms/pretty-php
https://github.com/lkrms/pretty-php/blob/5d244a4b7a9b484581edbb5df596a4e76ba17fa6/tests/fixtures/Formatter/in/3rdparty/php-doc/language/types/array/036.php
tests/fixtures/Formatter/in/3rdparty/php-doc/language/types/array/036.php
<?php $fruits = array ( "fruits" => array ( "a" => "orange", "b" => "banana", "c" => "apple" ), "numbers" => array ( 1, 2, ...
php
MIT
5d244a4b7a9b484581edbb5df596a4e76ba17fa6
2026-01-05T04:31:39.990954Z
false
lkrms/pretty-php
https://github.com/lkrms/pretty-php/blob/5d244a4b7a9b484581edbb5df596a4e76ba17fa6/tests/fixtures/Formatter/in/3rdparty/php-doc/language/types/array/004.php
tests/fixtures/Formatter/in/3rdparty/php-doc/language/types/array/004.php
<?php $array = array( "a", "b", 6 => "c", "d", ); var_dump($array); ?>
php
MIT
5d244a4b7a9b484581edbb5df596a4e76ba17fa6
2026-01-05T04:31:39.990954Z
false
lkrms/pretty-php
https://github.com/lkrms/pretty-php/blob/5d244a4b7a9b484581edbb5df596a4e76ba17fa6/tests/fixtures/Formatter/in/3rdparty/php-doc/language/types/array/022.php
tests/fixtures/Formatter/in/3rdparty/php-doc/language/types/array/022.php
<?php $error_descriptions[E_ERROR] = "A fatal error has occurred"; $error_descriptions[E_WARNING] = "PHP issued a warning"; $error_descriptions[E_NOTICE] = "This is just an informal notice"; ?>
php
MIT
5d244a4b7a9b484581edbb5df596a4e76ba17fa6
2026-01-05T04:31:39.990954Z
false
lkrms/pretty-php
https://github.com/lkrms/pretty-php/blob/5d244a4b7a9b484581edbb5df596a4e76ba17fa6/tests/fixtures/Formatter/in/3rdparty/php-doc/language/types/array/016.php
tests/fixtures/Formatter/in/3rdparty/php-doc/language/types/array/016.php
<?php $a = array(1 => 'one', 2 => 'two', 3 => 'three'); /* will produce an array that would have been defined as $a = array(1 => 'one', 3 => 'three'); and NOT $a = array(1 => 'one', 2 =>'three'); */ unset($a[2]); var_dump($a); $b = array_values($a); // Now $b is array(0 => 'one', 1 =>'three') var_dump($b); ?...
php
MIT
5d244a4b7a9b484581edbb5df596a4e76ba17fa6
2026-01-05T04:31:39.990954Z
false
lkrms/pretty-php
https://github.com/lkrms/pretty-php/blob/5d244a4b7a9b484581edbb5df596a4e76ba17fa6/tests/fixtures/Formatter/in/3rdparty/php-doc/language/types/array/001.php
tests/fixtures/Formatter/in/3rdparty/php-doc/language/types/array/001.php
<?php $array = array( 1 => "a", "1" => "b", 1.5 => "c", true => "d", ); var_dump($array); ?>
php
MIT
5d244a4b7a9b484581edbb5df596a4e76ba17fa6
2026-01-05T04:31:39.990954Z
false
lkrms/pretty-php
https://github.com/lkrms/pretty-php/blob/5d244a4b7a9b484581edbb5df596a4e76ba17fa6/tests/fixtures/Formatter/in/3rdparty/php-doc/language/types/array/002.php
tests/fixtures/Formatter/in/3rdparty/php-doc/language/types/array/002.php
<?php $array = array( "foo" => "bar", "bar" => "foo", 100 => -100, -100 => 100, ); var_dump($array); ?>
php
MIT
5d244a4b7a9b484581edbb5df596a4e76ba17fa6
2026-01-05T04:31:39.990954Z
false
lkrms/pretty-php
https://github.com/lkrms/pretty-php/blob/5d244a4b7a9b484581edbb5df596a4e76ba17fa6/tests/fixtures/Formatter/in/3rdparty/php-doc/language/types/array/025.php
tests/fixtures/Formatter/in/3rdparty/php-doc/language/types/array/025.php
<?php class A { private $A; // This will become '\0A\0A' } class B extends A { private $A; // This will become '\0B\0A' public $AA; // This will become 'AA' } var_dump((array) new B()); ?>
php
MIT
5d244a4b7a9b484581edbb5df596a4e76ba17fa6
2026-01-05T04:31:39.990954Z
false
lkrms/pretty-php
https://github.com/lkrms/pretty-php/blob/5d244a4b7a9b484581edbb5df596a4e76ba17fa6/tests/fixtures/Formatter/in/3rdparty/php-doc/language/types/array/024.php
tests/fixtures/Formatter/in/3rdparty/php-doc/language/types/array/024.php
<?php class A { private $B; protected $C; public $D; function __construct() { $this->{1} = null; } } var_export((array) new A()); ?>
php
MIT
5d244a4b7a9b484581edbb5df596a4e76ba17fa6
2026-01-05T04:31:39.990954Z
false
lkrms/pretty-php
https://github.com/lkrms/pretty-php/blob/5d244a4b7a9b484581edbb5df596a4e76ba17fa6/tests/fixtures/Formatter/in/3rdparty/php-doc/language/types/array/032.php
tests/fixtures/Formatter/in/3rdparty/php-doc/language/types/array/032.php
<?php $colors = array('red', 'blue', 'green', 'yellow'); foreach ($colors as &$color) { $color = mb_strtoupper($color); } unset($color); /* ensure that following writes to $color will not modify the last array element */ print_r($colors); ?>
php
MIT
5d244a4b7a9b484581edbb5df596a4e76ba17fa6
2026-01-05T04:31:39.990954Z
false
lkrms/pretty-php
https://github.com/lkrms/pretty-php/blob/5d244a4b7a9b484581edbb5df596a4e76ba17fa6/tests/fixtures/Formatter/in/3rdparty/php-doc/language/types/array/011.php
tests/fixtures/Formatter/in/3rdparty/php-doc/language/types/array/011.php
<?php $source_array = ['foo', 'bar', 'baz']; [$foo, $bar, $baz] = $source_array; echo $foo, PHP_EOL; // prints "foo" echo $bar, PHP_EOL; // prints "bar" echo $baz, PHP_EOL; // prints "baz" ?>
php
MIT
5d244a4b7a9b484581edbb5df596a4e76ba17fa6
2026-01-05T04:31:39.990954Z
false
lkrms/pretty-php
https://github.com/lkrms/pretty-php/blob/5d244a4b7a9b484581edbb5df596a4e76ba17fa6/tests/fixtures/Formatter/in/3rdparty/php-doc/language/types/array/009.php
tests/fixtures/Formatter/in/3rdparty/php-doc/language/types/array/009.php
<?php $arr = array(5 => 1, 12 => 2); $arr[] = 56; // This is the same as $arr[13] = 56; // at this point of the script $arr["x"] = 42; // This adds a new element to // the array with key "x" unset($arr[5]); // This removes the element from the array var_dump($arr); unset($arr); ...
php
MIT
5d244a4b7a9b484581edbb5df596a4e76ba17fa6
2026-01-05T04:31:39.990954Z
false
lkrms/pretty-php
https://github.com/lkrms/pretty-php/blob/5d244a4b7a9b484581edbb5df596a4e76ba17fa6/tests/fixtures/Formatter/in/3rdparty/php-doc/language/types/array/029.php
tests/fixtures/Formatter/in/3rdparty/php-doc/language/types/array/029.php
<?php // This: $a = array( 'color' => 'red', 'taste' => 'sweet', 'shape' => 'round', 'name' => 'apple', 4 // key will be 0 ); $b = array('a', 'b', 'c'); var_dump($a, $b); // . . .is completely equivalent with this: $a = array(); $a['color'] = 'red'; $...
php
MIT
5d244a4b7a9b484581edbb5df596a4e76ba17fa6
2026-01-05T04:31:39.990954Z
false
lkrms/pretty-php
https://github.com/lkrms/pretty-php/blob/5d244a4b7a9b484581edbb5df596a4e76ba17fa6/tests/fixtures/Formatter/in/3rdparty/php-doc/language/types/array/012.php
tests/fixtures/Formatter/in/3rdparty/php-doc/language/types/array/012.php
<?php $source_array = [ [1, 'John'], [2, 'Jane'], ]; foreach ($source_array as [$id, $name]) { echo "{$id}: '{$name}'\n"; } ?>
php
MIT
5d244a4b7a9b484581edbb5df596a4e76ba17fa6
2026-01-05T04:31:39.990954Z
false
lkrms/pretty-php
https://github.com/lkrms/pretty-php/blob/5d244a4b7a9b484581edbb5df596a4e76ba17fa6/tests/fixtures/Formatter/in/3rdparty/php-doc/language/types/array/019.php
tests/fixtures/Formatter/in/3rdparty/php-doc/language/types/array/019.php
<?php // Show all errors error_reporting(E_ALL); $arr = array('fruit' => 'apple', 'veggie' => 'carrot'); // Correct echo $arr['fruit'], PHP_EOL; // apple echo $arr['veggie'], PHP_EOL; // carrot // Incorrect. This does not work and throws a PHP Error because // of an undefined constant named fruit // // Error: Undef...
php
MIT
5d244a4b7a9b484581edbb5df596a4e76ba17fa6
2026-01-05T04:31:39.990954Z
false
lkrms/pretty-php
https://github.com/lkrms/pretty-php/blob/5d244a4b7a9b484581edbb5df596a4e76ba17fa6/tests/fixtures/Formatter/in/3rdparty/php-doc/language/types/array/014.php
tests/fixtures/Formatter/in/3rdparty/php-doc/language/types/array/014.php
<?php $source_array = ['foo' => 1, 'bar' => 2, 'baz' => 3]; // Assign the element at index 'baz' to the variable $three ['baz' => $three] = $source_array; echo $three, PHP_EOL; // prints 3 $source_array = ['foo', 'bar', 'baz']; // Assign the element at index 2 to the variable $baz [2 => $baz] = $source_array; ech...
php
MIT
5d244a4b7a9b484581edbb5df596a4e76ba17fa6
2026-01-05T04:31:39.990954Z
false
lkrms/pretty-php
https://github.com/lkrms/pretty-php/blob/5d244a4b7a9b484581edbb5df596a4e76ba17fa6/tests/fixtures/Formatter/in/3rdparty/php-doc/language/types/array/037.php
tests/fixtures/Formatter/in/3rdparty/php-doc/language/types/array/037.php
<?php $arr1 = array(2, 3); $arr2 = $arr1; $arr2[] = 4; // $arr2 is changed, // $arr1 is still array(2, 3) $arr3 = &$arr1; $arr3[] = 4; // now $arr1 and $arr3 are the same var_dump($arr1, $arr2, $arr3); ?>
php
MIT
5d244a4b7a9b484581edbb5df596a4e76ba17fa6
2026-01-05T04:31:39.990954Z
false
lkrms/pretty-php
https://github.com/lkrms/pretty-php/blob/5d244a4b7a9b484581edbb5df596a4e76ba17fa6/tests/fixtures/Formatter/in/3rdparty/php-doc/language/types/array/015.php
tests/fixtures/Formatter/in/3rdparty/php-doc/language/types/array/015.php
<?php $a = 1; $b = 2; [$b, $a] = [$a, $b]; echo $a, PHP_EOL; // prints 2 echo $b, PHP_EOL; // prints 1 ?>
php
MIT
5d244a4b7a9b484581edbb5df596a4e76ba17fa6
2026-01-05T04:31:39.990954Z
false
lkrms/pretty-php
https://github.com/lkrms/pretty-php/blob/5d244a4b7a9b484581edbb5df596a4e76ba17fa6/tests/fixtures/Formatter/in/3rdparty/php-doc/language/types/array/007.php
tests/fixtures/Formatter/in/3rdparty/php-doc/language/types/array/007.php
<?php $array = array( "foo" => "bar", 42 => 24, "multi" => array( "dimensional" => array( "array" => "foo" ) ) ); var_dump($array["foo"]); var_dump($array[42]); var_dump($array["multi"]["dimensional"]["array"]); ?>
php
MIT
5d244a4b7a9b484581edbb5df596a4e76ba17fa6
2026-01-05T04:31:39.990954Z
false
lkrms/pretty-php
https://github.com/lkrms/pretty-php/blob/5d244a4b7a9b484581edbb5df596a4e76ba17fa6/tests/fixtures/Formatter/in/3rdparty/php-doc/language/types/array/010.php
tests/fixtures/Formatter/in/3rdparty/php-doc/language/types/array/010.php
<?php // Create a simple array. $array = array(1, 2, 3, 4, 5); print_r($array); // Now delete every item, but leave the array itself intact: foreach ($array as $i => $value) { unset($array[$i]); } print_r($array); // Append an item (note that the new key is 5, instead of 0). $array[] = 6; print_r($array); // Re-...
php
MIT
5d244a4b7a9b484581edbb5df596a4e76ba17fa6
2026-01-05T04:31:39.990954Z
false
lkrms/pretty-php
https://github.com/lkrms/pretty-php/blob/5d244a4b7a9b484581edbb5df596a4e76ba17fa6/tests/fixtures/Formatter/in/3rdparty/php-doc/language/types/array/003.php
tests/fixtures/Formatter/in/3rdparty/php-doc/language/types/array/003.php
<?php $array = array("foo", "bar", "hello", "world"); var_dump($array); ?>
php
MIT
5d244a4b7a9b484581edbb5df596a4e76ba17fa6
2026-01-05T04:31:39.990954Z
false
lkrms/pretty-php
https://github.com/lkrms/pretty-php/blob/5d244a4b7a9b484581edbb5df596a4e76ba17fa6/tests/fixtures/Formatter/in/3rdparty/php-doc/language/types/array/023.php
tests/fixtures/Formatter/in/3rdparty/php-doc/language/types/array/023.php
<?php $error_descriptions[1] = "A fatal error has occurred"; $error_descriptions[2] = "PHP issued a warning"; $error_descriptions[8] = "This is just an informal notice"; ?>
php
MIT
5d244a4b7a9b484581edbb5df596a4e76ba17fa6
2026-01-05T04:31:39.990954Z
false
lkrms/pretty-php
https://github.com/lkrms/pretty-php/blob/5d244a4b7a9b484581edbb5df596a4e76ba17fa6/tests/fixtures/Formatter/in/3rdparty/php-doc/language/types/array/026.php
tests/fixtures/Formatter/in/3rdparty/php-doc/language/types/array/026.php
<?php // Using short array syntax. // Also, works with array() syntax. $arr1 = [1, 2, 3]; $arr2 = [...$arr1]; // [1, 2, 3] $arr3 = [0, ...$arr1]; // [0, 1, 2, 3] $arr4 = [...$arr1, ...$arr2, 111]; // [1, 2, 3, 1, 2, 3, 111] $arr5 = [...$arr1, ...$arr1]; // [1, 2, 3, 1, 2, 3] function getArr() { return ['a', 'b']; } ...
php
MIT
5d244a4b7a9b484581edbb5df596a4e76ba17fa6
2026-01-05T04:31:39.990954Z
false
lkrms/pretty-php
https://github.com/lkrms/pretty-php/blob/5d244a4b7a9b484581edbb5df596a4e76ba17fa6/tests/fixtures/Formatter/in/3rdparty/php-doc/language/types/array/008.php
tests/fixtures/Formatter/in/3rdparty/php-doc/language/types/array/008.php
<?php function getArray() { return array(1, 2, 3); } $secondElement = getArray()[1]; var_dump($secondElement); ?>
php
MIT
5d244a4b7a9b484581edbb5df596a4e76ba17fa6
2026-01-05T04:31:39.990954Z
false
lkrms/pretty-php
https://github.com/lkrms/pretty-php/blob/5d244a4b7a9b484581edbb5df596a4e76ba17fa6/tests/fixtures/Formatter/in/3rdparty/php-doc/language/types/array/000.php
tests/fixtures/Formatter/in/3rdparty/php-doc/language/types/array/000.php
<?php $array1 = array( "foo" => "bar", "bar" => "foo", ); // Using the short array syntax $array2 = [ "foo" => "bar", "bar" => "foo", ]; var_dump($array1, $array2); ?>
php
MIT
5d244a4b7a9b484581edbb5df596a4e76ba17fa6
2026-01-05T04:31:39.990954Z
false
lkrms/pretty-php
https://github.com/lkrms/pretty-php/blob/5d244a4b7a9b484581edbb5df596a4e76ba17fa6/tests/fixtures/Formatter/in/3rdparty/php-doc/language/types/array/005.php
tests/fixtures/Formatter/in/3rdparty/php-doc/language/types/array/005.php
<?php $array = array( 1 => 'a', '1' => 'b', // the value "a" will be overwritten by "b" 1.5 => 'c', // the value "b" will be overwritten by "c" -1 => 'd', '01' => 'e', // as this is not an integer string it will NOT override the key for 1 '1.5' => 'f', // as this is not an integer string i...
php
MIT
5d244a4b7a9b484581edbb5df596a4e76ba17fa6
2026-01-05T04:31:39.990954Z
false
lkrms/pretty-php
https://github.com/lkrms/pretty-php/blob/5d244a4b7a9b484581edbb5df596a4e76ba17fa6/tests/fixtures/Formatter/in/3rdparty/php-doc/language/types/array/030.php
tests/fixtures/Formatter/in/3rdparty/php-doc/language/types/array/030.php
<?php // Array as (property-)map $map = array( 'version' => 4, 'OS' => 'Linux', 'lang' => 'english', 'short_tags' => true ); var_dump($map); // strictly numerical keys // this is the same as array(0 => 7, 1 => 8, ...) $array = array( 7, ...
php
MIT
5d244a4b7a9b484581edbb5df596a4e76ba17fa6
2026-01-05T04:31:39.990954Z
false