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/out/02-aligned/3rdparty/php-doc/language/types/declarations/007.php
tests/fixtures/Formatter/out/02-aligned/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/out/02-aligned/3rdparty/php-doc/language/types/declarations/010.php
tests/fixtures/Formatter/out/02-aligned/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/out/02-aligned/3rdparty/php-doc/language/types/declarations/003.php
tests/fixtures/Formatter/out/02-aligned/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/out/02-aligned/3rdparty/php-doc/language/types/declarations/008.php
tests/fixtures/Formatter/out/02-aligned/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/out/02-aligned/3rdparty/php-doc/language/types/declarations/000.php
tests/fixtures/Formatter/out/02-aligned/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/out/02-aligned/3rdparty/php-doc/language/types/declarations/005.php
tests/fixtures/Formatter/out/02-aligned/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/out/02-aligned/3rdparty/php-doc/language/types/numeric-strings/001.php
tests/fixtures/Formatter/out/02-aligned/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 $fo...
php
MIT
5d244a4b7a9b484581edbb5df596a4e76ba17fa6
2026-01-05T04:31:39.990954Z
false
lkrms/pretty-php
https://github.com/lkrms/pretty-php/blob/5d244a4b7a9b484581edbb5df596a4e76ba17fa6/tests/fixtures/Formatter/out/02-aligned/3rdparty/php-doc/language/types/numeric-strings/000.php
tests/fixtures/Formatter/out/02-aligned/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/out/02-aligned/3rdparty/php-doc/language/types/null/000.php
tests/fixtures/Formatter/out/02-aligned/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/out/02-aligned/3rdparty/php-doc/language/types/array/028.php
tests/fixtures/Formatter/out/02-aligned/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/out/02-aligned/3rdparty/php-doc/language/types/array/031.php
tests/fixtures/Formatter/out/02-aligned/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/out/02-aligned/3rdparty/php-doc/language/types/array/006.php
tests/fixtures/Formatter/out/02-aligned/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/out/02-aligned/3rdparty/php-doc/language/types/array/018.php
tests/fixtures/Formatter/out/02-aligned/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/out/02-aligned/3rdparty/php-doc/language/types/array/017.php
tests/fixtures/Formatter/out/02-aligned/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/out/02-aligned/3rdparty/php-doc/language/types/array/013.php
tests/fixtures/Formatter/out/02-aligned/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/out/02-aligned/3rdparty/php-doc/language/types/array/036.php
tests/fixtures/Formatter/out/02-aligned/3rdparty/php-doc/language/types/array/036.php
<?php $fruits = array('fruits' => array('a' => 'orange', 'b' => 'banana', 'c' => 'apple'), 'numbers' => array(1, 2, 3, 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/out/02-aligned/3rdparty/php-doc/language/types/array/004.php
tests/fixtures/Formatter/out/02-aligned/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/out/02-aligned/3rdparty/php-doc/language/types/array/022.php
tests/fixtures/Formatter/out/02-aligned/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/out/02-aligned/3rdparty/php-doc/language/types/array/016.php
tests/fixtures/Formatter/out/02-aligned/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/out/02-aligned/3rdparty/php-doc/language/types/array/001.php
tests/fixtures/Formatter/out/02-aligned/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/out/02-aligned/3rdparty/php-doc/language/types/array/002.php
tests/fixtures/Formatter/out/02-aligned/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/out/02-aligned/3rdparty/php-doc/language/types/array/025.php
tests/fixtures/Formatter/out/02-aligned/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/out/02-aligned/3rdparty/php-doc/language/types/array/024.php
tests/fixtures/Formatter/out/02-aligned/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/out/02-aligned/3rdparty/php-doc/language/types/array/032.php
tests/fixtures/Formatter/out/02-aligned/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/out/02-aligned/3rdparty/php-doc/language/types/array/011.php
tests/fixtures/Formatter/out/02-aligned/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/out/02-aligned/3rdparty/php-doc/language/types/array/009.php
tests/fixtures/Formatter/out/02-aligned/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/out/02-aligned/3rdparty/php-doc/language/types/array/029.php
tests/fixtures/Formatter/out/02-aligned/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'; $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/out/02-aligned/3rdparty/php-doc/language/types/array/012.php
tests/fixtures/Formatter/out/02-aligned/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/out/02-aligned/3rdparty/php-doc/language/types/array/019.php
tests/fixtures/Formatter/out/02-aligned/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: Und...
php
MIT
5d244a4b7a9b484581edbb5df596a4e76ba17fa6
2026-01-05T04:31:39.990954Z
false
lkrms/pretty-php
https://github.com/lkrms/pretty-php/blob/5d244a4b7a9b484581edbb5df596a4e76ba17fa6/tests/fixtures/Formatter/out/02-aligned/3rdparty/php-doc/language/types/array/014.php
tests/fixtures/Formatter/out/02-aligned/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/out/02-aligned/3rdparty/php-doc/language/types/array/037.php
tests/fixtures/Formatter/out/02-aligned/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/out/02-aligned/3rdparty/php-doc/language/types/array/015.php
tests/fixtures/Formatter/out/02-aligned/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/out/02-aligned/3rdparty/php-doc/language/types/array/007.php
tests/fixtures/Formatter/out/02-aligned/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/out/02-aligned/3rdparty/php-doc/language/types/array/010.php
tests/fixtures/Formatter/out/02-aligned/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/out/02-aligned/3rdparty/php-doc/language/types/array/003.php
tests/fixtures/Formatter/out/02-aligned/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/out/02-aligned/3rdparty/php-doc/language/types/array/023.php
tests/fixtures/Formatter/out/02-aligned/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/out/02-aligned/3rdparty/php-doc/language/types/array/026.php
tests/fixtures/Formatter/out/02-aligned/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] functio...
php
MIT
5d244a4b7a9b484581edbb5df596a4e76ba17fa6
2026-01-05T04:31:39.990954Z
false
lkrms/pretty-php
https://github.com/lkrms/pretty-php/blob/5d244a4b7a9b484581edbb5df596a4e76ba17fa6/tests/fixtures/Formatter/out/02-aligned/3rdparty/php-doc/language/types/array/008.php
tests/fixtures/Formatter/out/02-aligned/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/out/02-aligned/3rdparty/php-doc/language/types/array/000.php
tests/fixtures/Formatter/out/02-aligned/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/out/02-aligned/3rdparty/php-doc/language/types/array/005.php
tests/fixtures/Formatter/out/02-aligned/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 intege...
php
MIT
5d244a4b7a9b484581edbb5df596a4e76ba17fa6
2026-01-05T04:31:39.990954Z
false
lkrms/pretty-php
https://github.com/lkrms/pretty-php/blob/5d244a4b7a9b484581edbb5df596a4e76ba17fa6/tests/fixtures/Formatter/out/02-aligned/3rdparty/php-doc/language/types/array/030.php
tests/fixtures/Formatter/out/02-aligned/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, 8, ...
php
MIT
5d244a4b7a9b484581edbb5df596a4e76ba17fa6
2026-01-05T04:31:39.990954Z
false
lkrms/pretty-php
https://github.com/lkrms/pretty-php/blob/5d244a4b7a9b484581edbb5df596a4e76ba17fa6/tests/fixtures/Formatter/out/02-aligned/3rdparty/php-doc/language/types/array/027.php
tests/fixtures/Formatter/out/02-aligned/3rdparty/php-doc/language/types/array/027.php
<?php // string key $arr1 = ['a' => 1]; $arr2 = ['a' => 2]; $arr3 = ['a' => 0, ...$arr1, ...$arr2]; var_dump($arr3); // ["a" => 2] // integer key $arr4 = [1, 2, 3]; $arr5 = [4, 5, 6]; $arr6 = [...$arr4, ...$arr5]; var_dump($arr6); // [1, 2, 3, 4, 5, 6] // Which is [0 => 1, 1 => 2, 2 => 3, 3 => 4, 4 => 5, 5 => 6] // ...
php
MIT
5d244a4b7a9b484581edbb5df596a4e76ba17fa6
2026-01-05T04:31:39.990954Z
false
lkrms/pretty-php
https://github.com/lkrms/pretty-php/blob/5d244a4b7a9b484581edbb5df596a4e76ba17fa6/tests/fixtures/Formatter/out/02-aligned/3rdparty/php-doc/language/types/array/034.php
tests/fixtures/Formatter/out/02-aligned/3rdparty/php-doc/language/types/array/034.php
<?php // fill an array with all items from a directory $handle = opendir('.'); while (false !== ($file = readdir($handle))) { $files[] = $file; } closedir($handle); var_dump($files); ?>
php
MIT
5d244a4b7a9b484581edbb5df596a4e76ba17fa6
2026-01-05T04:31:39.990954Z
false
lkrms/pretty-php
https://github.com/lkrms/pretty-php/blob/5d244a4b7a9b484581edbb5df596a4e76ba17fa6/tests/fixtures/Formatter/out/02-aligned/3rdparty/php-doc/language/types/array/035.php
tests/fixtures/Formatter/out/02-aligned/3rdparty/php-doc/language/types/array/035.php
<?php sort($files); print_r($files); ?>
php
MIT
5d244a4b7a9b484581edbb5df596a4e76ba17fa6
2026-01-05T04:31:39.990954Z
false
lkrms/pretty-php
https://github.com/lkrms/pretty-php/blob/5d244a4b7a9b484581edbb5df596a4e76ba17fa6/tests/fixtures/Formatter/out/02-aligned/3rdparty/php-doc/language/types/array/033.php
tests/fixtures/Formatter/out/02-aligned/3rdparty/php-doc/language/types/array/033.php
<?php $firstquarter = array(1 => 'January', 'February', 'March'); print_r($firstquarter); ?>
php
MIT
5d244a4b7a9b484581edbb5df596a4e76ba17fa6
2026-01-05T04:31:39.990954Z
false
lkrms/pretty-php
https://github.com/lkrms/pretty-php/blob/5d244a4b7a9b484581edbb5df596a4e76ba17fa6/tests/fixtures/Formatter/out/02-aligned/3rdparty/php-doc/language/types/array/021.php
tests/fixtures/Formatter/out/02-aligned/3rdparty/php-doc/language/types/array/021.php
<?php echo $arr[somefunc($bar)]; ?>
php
MIT
5d244a4b7a9b484581edbb5df596a4e76ba17fa6
2026-01-05T04:31:39.990954Z
false
lkrms/pretty-php
https://github.com/lkrms/pretty-php/blob/5d244a4b7a9b484581edbb5df596a4e76ba17fa6/tests/fixtures/Formatter/out/02-aligned/3rdparty/php-doc/language/types/callable/001.php
tests/fixtures/Formatter/out/02-aligned/3rdparty/php-doc/language/types/callable/001.php
<?php // Using anonymous function syntax $double1 = function ($a) { return $a * 2; }; // Using first-class callable syntax function double_function($a) { return $a * 2; } $double2 = double_function(...); // Using arrow function syntax $double3 = fn($a) => $a * 2; // Using Closure::fromCallable $double4 = Cl...
php
MIT
5d244a4b7a9b484581edbb5df596a4e76ba17fa6
2026-01-05T04:31:39.990954Z
false
lkrms/pretty-php
https://github.com/lkrms/pretty-php/blob/5d244a4b7a9b484581edbb5df596a4e76ba17fa6/tests/fixtures/Formatter/out/02-aligned/3rdparty/php-doc/language/types/callable/002.php
tests/fixtures/Formatter/out/02-aligned/3rdparty/php-doc/language/types/callable/002.php
<?php // An example callback function function my_callback_function() { echo 'hello world!', PHP_EOL; } // An example callback method class MyClass { static function myCallbackMethod() { echo 'Hello World!', PHP_EOL; } } // Type 1: Simple callback call_user_func('my_callback_function'); // 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/out/02-aligned/3rdparty/php-doc/language/types/callable/000.php
tests/fixtures/Formatter/out/02-aligned/3rdparty/php-doc/language/types/callable/000.php
<?php function foo(callable $callback) { $callback(); } ?>
php
MIT
5d244a4b7a9b484581edbb5df596a4e76ba17fa6
2026-01-05T04:31:39.990954Z
false
lkrms/pretty-php
https://github.com/lkrms/pretty-php/blob/5d244a4b7a9b484581edbb5df596a4e76ba17fa6/tests/fixtures/Formatter/out/02-aligned/3rdparty/php-doc/language/types/iterable/000.php
tests/fixtures/Formatter/out/02-aligned/3rdparty/php-doc/language/types/iterable/000.php
<?php function gen(): iterable { yield 1; yield 2; yield 3; } foreach (gen() as $value) { echo $value, "\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/out/02-aligned/3rdparty/php-doc/language/types/type-juggling/004.php
tests/fixtures/Formatter/out/02-aligned/3rdparty/php-doc/language/types/type-juggling/004.php
<?php $foo = 10; // $foo is an integer $str = "$foo"; // $str is a string $fst = (string) $foo; // $fst is also a string // This prints out that "they are the same" if ($fst === $str) { echo 'they are the same', 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/out/02-aligned/3rdparty/php-doc/language/types/type-juggling/001.php
tests/fixtures/Formatter/out/02-aligned/3rdparty/php-doc/language/types/type-juggling/001.php
<?php $foo = 10; // $foo is an integer $bar = (bool) $foo; // $bar is a boolean var_dump($bar); ?>
php
MIT
5d244a4b7a9b484581edbb5df596a4e76ba17fa6
2026-01-05T04:31:39.990954Z
false
lkrms/pretty-php
https://github.com/lkrms/pretty-php/blob/5d244a4b7a9b484581edbb5df596a4e76ba17fa6/tests/fixtures/Formatter/out/02-aligned/3rdparty/php-doc/language/types/type-juggling/002.php
tests/fixtures/Formatter/out/02-aligned/3rdparty/php-doc/language/types/type-juggling/002.php
<?php $foo = (int) $bar; $foo = (int) $bar; ?>
php
MIT
5d244a4b7a9b484581edbb5df596a4e76ba17fa6
2026-01-05T04:31:39.990954Z
false
lkrms/pretty-php
https://github.com/lkrms/pretty-php/blob/5d244a4b7a9b484581edbb5df596a4e76ba17fa6/tests/fixtures/Formatter/out/02-aligned/3rdparty/php-doc/language/types/type-juggling/003.php
tests/fixtures/Formatter/out/02-aligned/3rdparty/php-doc/language/types/type-juggling/003.php
<?php $binary = (string) $string; $binary = 'binary string'; ?>
php
MIT
5d244a4b7a9b484581edbb5df596a4e76ba17fa6
2026-01-05T04:31:39.990954Z
false
lkrms/pretty-php
https://github.com/lkrms/pretty-php/blob/5d244a4b7a9b484581edbb5df596a4e76ba17fa6/tests/fixtures/Formatter/out/02-aligned/3rdparty/php-doc/language/types/type-juggling/005.php
tests/fixtures/Formatter/out/02-aligned/3rdparty/php-doc/language/types/type-juggling/005.php
<?php $a = 'car'; // $a is a string $a[0] = 'b'; // $a is still a string echo $a; // bar ?>
php
MIT
5d244a4b7a9b484581edbb5df596a4e76ba17fa6
2026-01-05T04:31:39.990954Z
false
lkrms/pretty-php
https://github.com/lkrms/pretty-php/blob/5d244a4b7a9b484581edbb5df596a4e76ba17fa6/tests/fixtures/Formatter/out/02-aligned/3rdparty/php-doc/language/attributes/006.php
tests/fixtures/Formatter/out/02-aligned/3rdparty/php-doc/language/attributes/006.php
<?php namespace Example; use Attribute; #[Attribute(Attribute::TARGET_METHOD | Attribute::TARGET_FUNCTION | Attribute::IS_REPEATABLE)] class MyAttribute {}
php
MIT
5d244a4b7a9b484581edbb5df596a4e76ba17fa6
2026-01-05T04:31:39.990954Z
false
lkrms/pretty-php
https://github.com/lkrms/pretty-php/blob/5d244a4b7a9b484581edbb5df596a4e76ba17fa6/tests/fixtures/Formatter/out/02-aligned/3rdparty/php-doc/language/attributes/004.php
tests/fixtures/Formatter/out/02-aligned/3rdparty/php-doc/language/attributes/004.php
<?php namespace Example; use Attribute; #[Attribute] class MyAttribute {}
php
MIT
5d244a4b7a9b484581edbb5df596a4e76ba17fa6
2026-01-05T04:31:39.990954Z
false
lkrms/pretty-php
https://github.com/lkrms/pretty-php/blob/5d244a4b7a9b484581edbb5df596a4e76ba17fa6/tests/fixtures/Formatter/out/02-aligned/3rdparty/php-doc/language/attributes/001.php
tests/fixtures/Formatter/out/02-aligned/3rdparty/php-doc/language/attributes/001.php
<?php // a.php namespace MyExample; use Attribute; #[Attribute] class MyAttribute { const VALUE = 'value'; private $value; public function __construct($value = null) { $this->value = $value; } } // b.php namespace Another; use MyExample\MyAttribute; #[MyAttribute] #[\MyExample\MyAttr...
php
MIT
5d244a4b7a9b484581edbb5df596a4e76ba17fa6
2026-01-05T04:31:39.990954Z
false
lkrms/pretty-php
https://github.com/lkrms/pretty-php/blob/5d244a4b7a9b484581edbb5df596a4e76ba17fa6/tests/fixtures/Formatter/out/02-aligned/3rdparty/php-doc/language/attributes/002.php
tests/fixtures/Formatter/out/02-aligned/3rdparty/php-doc/language/attributes/002.php
<?php #[Attribute] class MyAttribute { public $value; public function __construct($value) { $this->value = $value; } } #[MyAttribute(value: 1234)] class Thing {} function dumpAttributeData($reflection) { $attributes = $reflection->getAttributes(); foreach ($attributes as $attribute)...
php
MIT
5d244a4b7a9b484581edbb5df596a4e76ba17fa6
2026-01-05T04:31:39.990954Z
false
lkrms/pretty-php
https://github.com/lkrms/pretty-php/blob/5d244a4b7a9b484581edbb5df596a4e76ba17fa6/tests/fixtures/Formatter/out/02-aligned/3rdparty/php-doc/language/attributes/003.php
tests/fixtures/Formatter/out/02-aligned/3rdparty/php-doc/language/attributes/003.php
<?php function dumpMyAttributeData($reflection) { $attributes = $reflection->getAttributes(MyAttribute::class); foreach ($attributes as $attribute) { var_dump($attribute->getName()); var_dump($attribute->getArguments()); var_dump($attribute->newInstance()); } } dumpMyAttributeData...
php
MIT
5d244a4b7a9b484581edbb5df596a4e76ba17fa6
2026-01-05T04:31:39.990954Z
false
lkrms/pretty-php
https://github.com/lkrms/pretty-php/blob/5d244a4b7a9b484581edbb5df596a4e76ba17fa6/tests/fixtures/Formatter/out/02-aligned/3rdparty/php-doc/language/attributes/000.php
tests/fixtures/Formatter/out/02-aligned/3rdparty/php-doc/language/attributes/000.php
<?php interface ActionHandler { public function execute(); } #[Attribute] class SetUp {} class CopyFile implements ActionHandler { public string $fileName; public string $targetDirectory; #[SetUp] public function fileExists() { if (!file_exists($this->fileName)) { throw ne...
php
MIT
5d244a4b7a9b484581edbb5df596a4e76ba17fa6
2026-01-05T04:31:39.990954Z
false
lkrms/pretty-php
https://github.com/lkrms/pretty-php/blob/5d244a4b7a9b484581edbb5df596a4e76ba17fa6/tests/fixtures/Formatter/out/02-aligned/3rdparty/php-doc/language/attributes/005.php
tests/fixtures/Formatter/out/02-aligned/3rdparty/php-doc/language/attributes/005.php
<?php namespace Example; use Attribute; #[Attribute(Attribute::TARGET_METHOD | Attribute::TARGET_FUNCTION)] class MyAttribute {}
php
MIT
5d244a4b7a9b484581edbb5df596a4e76ba17fa6
2026-01-05T04:31:39.990954Z
false
lkrms/pretty-php
https://github.com/lkrms/pretty-php/blob/5d244a4b7a9b484581edbb5df596a4e76ba17fa6/tests/fixtures/Formatter/out/02-aligned/3rdparty/php-doc/language/attributes/001.PHP74.php
tests/fixtures/Formatter/out/02-aligned/3rdparty/php-doc/language/attributes/001.PHP74.php
<?php // a.php namespace MyExample; use Attribute; #[Attribute] class MyAttribute { const VALUE = 'value'; private $value; public function __construct($value = null) { $this->value = $value; } } // b.php namespace Another; use MyExample\MyAttribute; #[MyAttribute] #[\MyExample\MyAttr...
php
MIT
5d244a4b7a9b484581edbb5df596a4e76ba17fa6
2026-01-05T04:31:39.990954Z
false
lkrms/pretty-php
https://github.com/lkrms/pretty-php/blob/5d244a4b7a9b484581edbb5df596a4e76ba17fa6/tests/fixtures/Formatter/out/02-aligned/3rdparty/php-doc/language/wrappers/ssh2/001.php
tests/fixtures/Formatter/out/02-aligned/3rdparty/php-doc/language/wrappers/ssh2/001.php
<?php $session = ssh2_connect('example.com', 22); ssh2_auth_pubkey_file($session, 'username', '/home/username/.ssh/id_rsa.pub', '/home/username/.ssh/id_rsa', 'secret'); $connection_string = "ssh2.sftp://$session/"; unset($session); $stream = fopen($connection_string . 'path/to/file', 'r'); ?>
php
MIT
5d244a4b7a9b484581edbb5df596a4e76ba17fa6
2026-01-05T04:31:39.990954Z
false
lkrms/pretty-php
https://github.com/lkrms/pretty-php/blob/5d244a4b7a9b484581edbb5df596a4e76ba17fa6/tests/fixtures/Formatter/out/02-aligned/3rdparty/php-doc/language/wrappers/ssh2/000.php
tests/fixtures/Formatter/out/02-aligned/3rdparty/php-doc/language/wrappers/ssh2/000.php
<?php $session = ssh2_connect('example.com', 22); ssh2_auth_pubkey_file($session, 'username', '/home/username/.ssh/id_rsa.pub', '/home/username/.ssh/id_rsa', 'secret'); $stream = fopen("ssh2.tunnel://$session/remote.example.com:1234", 'r'); ?>
php
MIT
5d244a4b7a9b484581edbb5df596a4e76ba17fa6
2026-01-05T04:31:39.990954Z
false
lkrms/pretty-php
https://github.com/lkrms/pretty-php/blob/5d244a4b7a9b484581edbb5df596a4e76ba17fa6/tests/fixtures/Formatter/out/02-aligned/3rdparty/php-doc/language/wrappers/rar/001.php
tests/fixtures/Formatter/out/02-aligned/3rdparty/php-doc/language/wrappers/rar/001.php
<?php $stream = fopen('rar://' . rawurlencode(dirname(__FILE__)) . DIRECTORY_SEPARATOR . 'encrypted_headers.rar' . '#encfile1.txt', 'r', false, stream_context_create( array( 'rar' => 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/out/02-aligned/3rdparty/php-doc/language/wrappers/rar/000.php
tests/fixtures/Formatter/out/02-aligned/3rdparty/php-doc/language/wrappers/rar/000.php
<?php class MyRecDirIt extends RecursiveDirectoryIterator { function current() { return rawurldecode($this->getSubPathName()) . (is_dir(parent::current()) ? ' [DIR]' : ''); } } $f = 'rar://' . rawurlencode(dirname(__FILE__)) . DIRECTORY_SEPARATOR . 'dirs_and_extra_headers.rar#'; $...
php
MIT
5d244a4b7a9b484581edbb5df596a4e76ba17fa6
2026-01-05T04:31:39.990954Z
false
lkrms/pretty-php
https://github.com/lkrms/pretty-php/blob/5d244a4b7a9b484581edbb5df596a4e76ba17fa6/tests/fixtures/Formatter/out/02-aligned/3rdparty/php-doc/language/wrappers/glob/000.php
tests/fixtures/Formatter/out/02-aligned/3rdparty/php-doc/language/wrappers/glob/000.php
<?php // Loop over all *.php files in ext/spl/examples/ directory // and print the filename and its size $it = new DirectoryIterator('glob://ext/spl/examples/*.php'); foreach ($it as $f) { printf("%s: %.1FK\n", $f->getFilename(), $f->getSize() / 1024); } ?>
php
MIT
5d244a4b7a9b484581edbb5df596a4e76ba17fa6
2026-01-05T04:31:39.990954Z
false
lkrms/pretty-php
https://github.com/lkrms/pretty-php/blob/5d244a4b7a9b484581edbb5df596a4e76ba17fa6/tests/fixtures/Formatter/out/02-aligned/3rdparty/php-doc/language/wrappers/data/001.php
tests/fixtures/Formatter/out/02-aligned/3rdparty/php-doc/language/wrappers/data/001.php
<?php $fp = fopen('data://text/plain;base64,', 'r'); $meta = stream_get_meta_data($fp); // prints "text/plain" echo $meta['mediatype']; ?>
php
MIT
5d244a4b7a9b484581edbb5df596a4e76ba17fa6
2026-01-05T04:31:39.990954Z
false
lkrms/pretty-php
https://github.com/lkrms/pretty-php/blob/5d244a4b7a9b484581edbb5df596a4e76ba17fa6/tests/fixtures/Formatter/out/02-aligned/3rdparty/php-doc/language/wrappers/data/000.php
tests/fixtures/Formatter/out/02-aligned/3rdparty/php-doc/language/wrappers/data/000.php
<?php // prints "I love PHP" echo file_get_contents('data://text/plain;base64,SSBsb3ZlIFBIUAo='); ?>
php
MIT
5d244a4b7a9b484581edbb5df596a4e76ba17fa6
2026-01-05T04:31:39.990954Z
false
lkrms/pretty-php
https://github.com/lkrms/pretty-php/blob/5d244a4b7a9b484581edbb5df596a4e76ba17fa6/tests/fixtures/Formatter/out/02-aligned/3rdparty/php-doc/language/wrappers/php/004.php
tests/fixtures/Formatter/out/02-aligned/3rdparty/php-doc/language/wrappers/php/004.php
<?php file_put_contents('php://memory', 'PHP'); echo file_get_contents('php://memory'); // prints nothing
php
MIT
5d244a4b7a9b484581edbb5df596a4e76ba17fa6
2026-01-05T04:31:39.990954Z
false
lkrms/pretty-php
https://github.com/lkrms/pretty-php/blob/5d244a4b7a9b484581edbb5df596a4e76ba17fa6/tests/fixtures/Formatter/out/02-aligned/3rdparty/php-doc/language/wrappers/php/001.php
tests/fixtures/Formatter/out/02-aligned/3rdparty/php-doc/language/wrappers/php/001.php
<?php /* This is equivalent to simply: readfile("http://www.example.com"); since no filters are actually specified */ readfile('php://filter/resource=http://www.example.com'); ?>
php
MIT
5d244a4b7a9b484581edbb5df596a4e76ba17fa6
2026-01-05T04:31:39.990954Z
false
lkrms/pretty-php
https://github.com/lkrms/pretty-php/blob/5d244a4b7a9b484581edbb5df596a4e76ba17fa6/tests/fixtures/Formatter/out/02-aligned/3rdparty/php-doc/language/wrappers/php/002.php
tests/fixtures/Formatter/out/02-aligned/3rdparty/php-doc/language/wrappers/php/002.php
<?php /* This will output the contents of www.example.com entirely in uppercase */ readfile('php://filter/read=string.toupper/resource=http://www.example.com'); /* This will do the same as above but will also ROT13 encode it */ readfile('php://filter/read=string.toupper|string.rot13/resource=http://www.example.com...
php
MIT
5d244a4b7a9b484581edbb5df596a4e76ba17fa6
2026-01-05T04:31:39.990954Z
false
lkrms/pretty-php
https://github.com/lkrms/pretty-php/blob/5d244a4b7a9b484581edbb5df596a4e76ba17fa6/tests/fixtures/Formatter/out/02-aligned/3rdparty/php-doc/language/wrappers/php/003.php
tests/fixtures/Formatter/out/02-aligned/3rdparty/php-doc/language/wrappers/php/003.php
<?php /* This will filter the string "Hello World" through the rot13 filter, then write to example.txt in the current directory */ file_put_contents('php://filter/write=string.rot13/resource=example.txt', 'Hello World'); ?>
php
MIT
5d244a4b7a9b484581edbb5df596a4e76ba17fa6
2026-01-05T04:31:39.990954Z
false
lkrms/pretty-php
https://github.com/lkrms/pretty-php/blob/5d244a4b7a9b484581edbb5df596a4e76ba17fa6/tests/fixtures/Formatter/out/02-aligned/3rdparty/php-doc/language/wrappers/php/000.php
tests/fixtures/Formatter/out/02-aligned/3rdparty/php-doc/language/wrappers/php/000.php
<?php // Set the limit to 5 MB. $fiveMBs = 5 * 1024 * 1024; $fp = fopen("php://temp/maxmemory:$fiveMBs", 'r+'); fputs($fp, "hello\n"); // Read what we have written. rewind($fp); echo stream_get_contents($fp); ?>
php
MIT
5d244a4b7a9b484581edbb5df596a4e76ba17fa6
2026-01-05T04:31:39.990954Z
false
lkrms/pretty-php
https://github.com/lkrms/pretty-php/blob/5d244a4b7a9b484581edbb5df596a4e76ba17fa6/tests/fixtures/Formatter/out/02-aligned/3rdparty/php-doc/language/wrappers/php/005.php
tests/fixtures/Formatter/out/02-aligned/3rdparty/php-doc/language/wrappers/php/005.php
<?php $input = file_get_contents('php://input'); $json_array = json_decode( json: $input, associative: true, flags: JSON_THROW_ON_ERROR ); echo 'Received JSON data: '; print_r($json_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/out/02-aligned/3rdparty/php-doc/language/wrappers/http/000.php
tests/fixtures/Formatter/out/02-aligned/3rdparty/php-doc/language/wrappers/http/000.php
<?php $url = 'http://www.example.com/redirecting_page.php'; $fp = fopen($url, 'r'); $meta_data = stream_get_meta_data($fp); foreach ($meta_data['wrapper_data'] as $response) { /* Were we redirected? */ if (strtolower(substr($response, 0, 10)) == 'location: ') { /* update $url with where we were redire...
php
MIT
5d244a4b7a9b484581edbb5df596a4e76ba17fa6
2026-01-05T04:31:39.990954Z
false
lkrms/pretty-php
https://github.com/lkrms/pretty-php/blob/5d244a4b7a9b484581edbb5df596a4e76ba17fa6/tests/fixtures/Formatter/out/02-aligned/3rdparty/php-doc/language/predefined/stringable/000.php
tests/fixtures/Formatter/out/02-aligned/3rdparty/php-doc/language/predefined/stringable/000.php
<?php class IPv4Address implements Stringable { public function __construct( private string $oct1, private string $oct2, private string $oct3, private string $oct4, ) {} public function __toString(): string { return "$this->oct1.$this->oct2.$this->oct3.$this->oct...
php
MIT
5d244a4b7a9b484581edbb5df596a4e76ba17fa6
2026-01-05T04:31:39.990954Z
false
lkrms/pretty-php
https://github.com/lkrms/pretty-php/blob/5d244a4b7a9b484581edbb5df596a4e76ba17fa6/tests/fixtures/Formatter/out/02-aligned/3rdparty/php-doc/language/predefined/iteratoraggregate/000.php
tests/fixtures/Formatter/out/02-aligned/3rdparty/php-doc/language/predefined/iteratoraggregate/000.php
<?php class myData implements IteratorAggregate { public $property1 = 'Public property one'; public $property2 = 'Public property two'; public $property3 = 'Public property three'; public $property4 = ''; public function __construct() { $this->property4 = 'last property'; } pu...
php
MIT
5d244a4b7a9b484581edbb5df596a4e76ba17fa6
2026-01-05T04:31:39.990954Z
false
lkrms/pretty-php
https://github.com/lkrms/pretty-php/blob/5d244a4b7a9b484581edbb5df596a4e76ba17fa6/tests/fixtures/Formatter/out/02-aligned/3rdparty/php-doc/language/predefined/error/gettrace/000.php
tests/fixtures/Formatter/out/02-aligned/3rdparty/php-doc/language/predefined/error/gettrace/000.php
<?php function test() { throw new Error; } try { test(); } catch (Error $e) { var_dump($e->getTrace()); } ?>
php
MIT
5d244a4b7a9b484581edbb5df596a4e76ba17fa6
2026-01-05T04:31:39.990954Z
false
lkrms/pretty-php
https://github.com/lkrms/pretty-php/blob/5d244a4b7a9b484581edbb5df596a4e76ba17fa6/tests/fixtures/Formatter/out/02-aligned/3rdparty/php-doc/language/predefined/error/getfile/000.php
tests/fixtures/Formatter/out/02-aligned/3rdparty/php-doc/language/predefined/error/getfile/000.php
<?php try { throw new Error; } catch (Error $e) { echo $e->getFile(); } ?>
php
MIT
5d244a4b7a9b484581edbb5df596a4e76ba17fa6
2026-01-05T04:31:39.990954Z
false
lkrms/pretty-php
https://github.com/lkrms/pretty-php/blob/5d244a4b7a9b484581edbb5df596a4e76ba17fa6/tests/fixtures/Formatter/out/02-aligned/3rdparty/php-doc/language/predefined/error/getline/000.php
tests/fixtures/Formatter/out/02-aligned/3rdparty/php-doc/language/predefined/error/getline/000.php
<?php try { throw new Error('Some error message'); } catch (Error $e) { echo 'The error was created on line: ' . $e->getLine(); } ?>
php
MIT
5d244a4b7a9b484581edbb5df596a4e76ba17fa6
2026-01-05T04:31:39.990954Z
false
lkrms/pretty-php
https://github.com/lkrms/pretty-php/blob/5d244a4b7a9b484581edbb5df596a4e76ba17fa6/tests/fixtures/Formatter/out/02-aligned/3rdparty/php-doc/language/predefined/error/gettraceasstring/000.php
tests/fixtures/Formatter/out/02-aligned/3rdparty/php-doc/language/predefined/error/gettraceasstring/000.php
<?php function test() { throw new Error; } try { test(); } catch (Error $e) { echo $e->getTraceAsString(); } ?>
php
MIT
5d244a4b7a9b484581edbb5df596a4e76ba17fa6
2026-01-05T04:31:39.990954Z
false
lkrms/pretty-php
https://github.com/lkrms/pretty-php/blob/5d244a4b7a9b484581edbb5df596a4e76ba17fa6/tests/fixtures/Formatter/out/02-aligned/3rdparty/php-doc/language/predefined/error/getcode/000.php
tests/fixtures/Formatter/out/02-aligned/3rdparty/php-doc/language/predefined/error/getcode/000.php
<?php try { throw new Error('Some error message', 30); } catch (Error $e) { echo 'The Error code is: ' . $e->getCode(); } ?>
php
MIT
5d244a4b7a9b484581edbb5df596a4e76ba17fa6
2026-01-05T04:31:39.990954Z
false
lkrms/pretty-php
https://github.com/lkrms/pretty-php/blob/5d244a4b7a9b484581edbb5df596a4e76ba17fa6/tests/fixtures/Formatter/out/02-aligned/3rdparty/php-doc/language/predefined/error/getprevious/000.php
tests/fixtures/Formatter/out/02-aligned/3rdparty/php-doc/language/predefined/error/getprevious/000.php
<?php class MyCustomError extends Error {} function doStuff() { try { throw new InvalidArgumentError('You are doing it wrong!', 112); } catch (Error $e) { throw new MyCustomError('Something happened', 911, $e); } } try { doStuff(); } catch (Error $e) { do { printf("%s:%d %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/out/02-aligned/3rdparty/php-doc/language/predefined/error/getmessage/000.php
tests/fixtures/Formatter/out/02-aligned/3rdparty/php-doc/language/predefined/error/getmessage/000.php
<?php try { throw new Error('Some error message'); } catch (Error $e) { echo $e->getMessage(); } ?>
php
MIT
5d244a4b7a9b484581edbb5df596a4e76ba17fa6
2026-01-05T04:31:39.990954Z
false
lkrms/pretty-php
https://github.com/lkrms/pretty-php/blob/5d244a4b7a9b484581edbb5df596a4e76ba17fa6/tests/fixtures/Formatter/out/02-aligned/3rdparty/php-doc/language/predefined/error/tostring/000.php
tests/fixtures/Formatter/out/02-aligned/3rdparty/php-doc/language/predefined/error/tostring/000.php
<?php try { throw new Error('Some error message'); } catch (Error $e) { echo $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/out/02-aligned/3rdparty/php-doc/language/predefined/iterator/000.php
tests/fixtures/Formatter/out/02-aligned/3rdparty/php-doc/language/predefined/iterator/000.php
<?php class myIterator implements Iterator { private $position = 0; private $array = array( 'firstelement', 'secondelement', 'lastelement', ); public function __construct() { $this->position = 0; } public function rewind(): void { var_dump(__MET...
php
MIT
5d244a4b7a9b484581edbb5df596a4e76ba17fa6
2026-01-05T04:31:39.990954Z
false
lkrms/pretty-php
https://github.com/lkrms/pretty-php/blob/5d244a4b7a9b484581edbb5df596a4e76ba17fa6/tests/fixtures/Formatter/out/02-aligned/3rdparty/php-doc/language/predefined/backedenum/from/000.php
tests/fixtures/Formatter/out/02-aligned/3rdparty/php-doc/language/predefined/backedenum/from/000.php
<?php enum Suit: string { case Hearts = 'H'; case Diamonds = 'D'; case Clubs = 'C'; case Spades = 'S'; } $h = Suit::from('H'); var_dump($h); $b = Suit::from('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/out/02-aligned/3rdparty/php-doc/language/predefined/backedenum/tryfrom/000.php
tests/fixtures/Formatter/out/02-aligned/3rdparty/php-doc/language/predefined/backedenum/tryfrom/000.php
<?php enum Suit: string { case Hearts = 'H'; case Diamonds = 'D'; case Clubs = 'C'; case Spades = 'S'; } $h = Suit::tryFrom('H'); var_dump($h); $b = Suit::tryFrom('B') ?? Suit::Spades; 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/out/02-aligned/3rdparty/php-doc/language/predefined/generator/throw/000.php
tests/fixtures/Formatter/out/02-aligned/3rdparty/php-doc/language/predefined/generator/throw/000.php
<?php function gen() { echo "Foo\n"; try { yield; } catch (Exception $e) { echo "Exception: {$e->getMessage()}\n"; } echo "Bar\n"; } $gen = gen(); $gen->rewind(); $gen->throw(new Exception('Test')); ?>
php
MIT
5d244a4b7a9b484581edbb5df596a4e76ba17fa6
2026-01-05T04:31:39.990954Z
false
lkrms/pretty-php
https://github.com/lkrms/pretty-php/blob/5d244a4b7a9b484581edbb5df596a4e76ba17fa6/tests/fixtures/Formatter/out/02-aligned/3rdparty/php-doc/language/predefined/generator/key/000.php
tests/fixtures/Formatter/out/02-aligned/3rdparty/php-doc/language/predefined/generator/key/000.php
<?php function Gen() { yield 'key' => 'value'; } $gen = Gen(); echo "{$gen->key()} => {$gen->current()}";
php
MIT
5d244a4b7a9b484581edbb5df596a4e76ba17fa6
2026-01-05T04:31:39.990954Z
false
lkrms/pretty-php
https://github.com/lkrms/pretty-php/blob/5d244a4b7a9b484581edbb5df596a4e76ba17fa6/tests/fixtures/Formatter/out/02-aligned/3rdparty/php-doc/language/predefined/generator/rewind/000.php
tests/fixtures/Formatter/out/02-aligned/3rdparty/php-doc/language/predefined/generator/rewind/000.php
<?php function generator(): Generator { echo "I'm a generator!\n"; for ($i = 1; $i <= 3; $i++) { yield $i; } } // Initialize the generator $generator = generator(); // Rewind the generator to the beginning of the first yield expression, // if it's not already there $generator->rewind(); // I'm ...
php
MIT
5d244a4b7a9b484581edbb5df596a4e76ba17fa6
2026-01-05T04:31:39.990954Z
false
lkrms/pretty-php
https://github.com/lkrms/pretty-php/blob/5d244a4b7a9b484581edbb5df596a4e76ba17fa6/tests/fixtures/Formatter/out/02-aligned/3rdparty/php-doc/language/predefined/generator/getreturn/000.php
tests/fixtures/Formatter/out/02-aligned/3rdparty/php-doc/language/predefined/generator/getreturn/000.php
<?php $gen = (function () { yield 1; yield 2; return 3; })(); foreach ($gen as $val) { echo $val, PHP_EOL; } echo $gen->getReturn(), 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/out/02-aligned/3rdparty/php-doc/language/predefined/generator/send/000.php
tests/fixtures/Formatter/out/02-aligned/3rdparty/php-doc/language/predefined/generator/send/000.php
<?php function printer() { echo "I'm printer!" . PHP_EOL; while (true) { $string = yield; echo $string . PHP_EOL; } } $printer = printer(); $printer->send('Hello world!'); $printer->send('Bye world!'); ?>
php
MIT
5d244a4b7a9b484581edbb5df596a4e76ba17fa6
2026-01-05T04:31:39.990954Z
false
lkrms/pretty-php
https://github.com/lkrms/pretty-php/blob/5d244a4b7a9b484581edbb5df596a4e76ba17fa6/tests/fixtures/Formatter/out/02-aligned/3rdparty/php-doc/language/predefined/variables/phperrormsg/000.php
tests/fixtures/Formatter/out/02-aligned/3rdparty/php-doc/language/predefined/variables/phperrormsg/000.php
<?php @strpos(); echo $php_errormsg; ?>
php
MIT
5d244a4b7a9b484581edbb5df596a4e76ba17fa6
2026-01-05T04:31:39.990954Z
false
lkrms/pretty-php
https://github.com/lkrms/pretty-php/blob/5d244a4b7a9b484581edbb5df596a4e76ba17fa6/tests/fixtures/Formatter/out/02-aligned/3rdparty/php-doc/language/predefined/variables/env/000.php
tests/fixtures/Formatter/out/02-aligned/3rdparty/php-doc/language/predefined/variables/env/000.php
<?php echo 'My username is ' . $_ENV['USER'] . '!'; ?>
php
MIT
5d244a4b7a9b484581edbb5df596a4e76ba17fa6
2026-01-05T04:31:39.990954Z
false
lkrms/pretty-php
https://github.com/lkrms/pretty-php/blob/5d244a4b7a9b484581edbb5df596a4e76ba17fa6/tests/fixtures/Formatter/out/02-aligned/3rdparty/php-doc/language/predefined/variables/cookie/000.php
tests/fixtures/Formatter/out/02-aligned/3rdparty/php-doc/language/predefined/variables/cookie/000.php
<?php echo 'Hello ' . htmlspecialchars($_COOKIE['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/out/02-aligned/3rdparty/php-doc/language/predefined/variables/globals/001.php
tests/fixtures/Formatter/out/02-aligned/3rdparty/php-doc/language/predefined/variables/globals/001.php
<?php // Generates compile-time error: $GLOBALS = []; $GLOBALS += []; $GLOBALS = &$x; $x = &$GLOBALS; unset($GLOBALS); array_pop($GLOBALS); // ...and any other write/read-write operation on $GLOBALS ?>
php
MIT
5d244a4b7a9b484581edbb5df596a4e76ba17fa6
2026-01-05T04:31:39.990954Z
false
lkrms/pretty-php
https://github.com/lkrms/pretty-php/blob/5d244a4b7a9b484581edbb5df596a4e76ba17fa6/tests/fixtures/Formatter/out/02-aligned/3rdparty/php-doc/language/predefined/variables/globals/002.php
tests/fixtures/Formatter/out/02-aligned/3rdparty/php-doc/language/predefined/variables/globals/002.php
<?php // Before PHP 8.1.0 $a = 1; $globals = $GLOBALS; // Ostensibly by-value copy $globals['a'] = 2; var_dump($a); // int(2) // As of PHP 8.1.0 // this no longer modifies $a. The previous behavior violated by-value semantics. $globals = $GLOBALS; $globals['a'] = 1; // To restore the previou...
php
MIT
5d244a4b7a9b484581edbb5df596a4e76ba17fa6
2026-01-05T04:31:39.990954Z
false