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/namespaces/023.php
tests/fixtures/Formatter/out/02-aligned/3rdparty/php-doc/language/namespaces/023.php
<?php use some\namespace\ClassA; use some\namespace\ClassB; use some\namespace\ClassC as C; use function some\namespace\fn_a; use function some\namespace\fn_b; use function some\namespace\fn_c; use const some\namespace\ConstA; use const some\namespace\ConstB; use const some\namespace\ConstC; // is equivalent to the...
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/namespaces/026.php
tests/fixtures/Formatter/out/02-aligned/3rdparty/php-doc/language/namespaces/026.php
<?php namespace A\B\C; const E_ERROR = 45; function strlen($str) { return \strlen($str) - 1; } echo E_ERROR, "\n"; // prints "45" echo INI_ALL, "\n"; // prints "7" - falls back to global INI_ALL echo strlen('hi'), "\n"; // prints "1" if (is_array('hi')) { // prints "is not array" echo "is array\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/namespaces/008.php
tests/fixtures/Formatter/out/02-aligned/3rdparty/php-doc/language/namespaces/008.php
<?php namespace Foo\Bar\subnamespace; const FOO = 1; function foo() {} class foo { static function staticmethod() {} } ?>
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/namespaces/000.php
tests/fixtures/Formatter/out/02-aligned/3rdparty/php-doc/language/namespaces/000.php
<?php namespace my\name; // see "Defining Namespaces" section class MyClass {} function myfunction() {} const MYCONST = 1; $a = new MyClass; $c = new \my\name\MyClass; // see "Global Space" section $a = strlen('hi'); // see "Using namespaces: fallback to global // function/constant" section ...
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/namespaces/005.php
tests/fixtures/Formatter/out/02-aligned/3rdparty/php-doc/language/namespaces/005.php
<?php namespace MyProject { const CONNECT_OK = 1; class Connection { /* ... */ } function connect() { /* ... */ } } namespace AnotherProject { const CONNECT_OK = 1; class Connection { /* ... */ } function connect() { /* ... */ } } ?>
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/namespaces/030.php
tests/fixtures/Formatter/out/02-aligned/3rdparty/php-doc/language/namespaces/030.php
<?php namespace foo; $a = new \stdClass; function test(\ArrayObject $parameter_type_example = null) {} $a = \DirectoryIterator::CURRENT_AS_FILEINFO; // extending an internal or global class class MyException extends \Exception {} ?>
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/namespaces/027.php
tests/fixtures/Formatter/out/02-aligned/3rdparty/php-doc/language/namespaces/027.php
<?php namespace A; use B\D, C\E as F; // function calls foo(); // first tries to call "foo" defined in namespace "A" // then calls global function "foo" \foo(); // calls function "foo" defined in global scope my\foo(); // calls function "foo" defined in namespace "A\my" F(); // first tries to call "F"...
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/namespaces/034.php
tests/fixtures/Formatter/out/02-aligned/3rdparty/php-doc/language/namespaces/034.php
<?php namespace foo; use blah\blah as foo; $a = new name(); // instantiates "foo\name" class foo::name(); // calls static method "name" in class "blah\blah" ?>
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/namespaces/035.php
tests/fixtures/Formatter/out/02-aligned/3rdparty/php-doc/language/namespaces/035.php
<?php namespace foo; use blah\blah as foo; const FOO = 1; function my() {} function foo() {} function sort(&$a) { \sort($a); // calls the global function "sort" $a = array_flip($a); return $a; } my(); // calls "foo\my" $a = strlen('hi'); // calls global function "strlen" because "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/namespaces/042.php
tests/fixtures/Formatter/out/02-aligned/3rdparty/php-doc/language/namespaces/042.php
<?php $a = "dangerous\name"; // \n is a newline inside double quoted strings! $obj = new $a; $a = 'not\at\all\dangerous'; // no problems here. $obj = 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/namespaces/039.php
tests/fixtures/Formatter/out/02-aligned/3rdparty/php-doc/language/namespaces/039.php
<?php namespace my\stuff; use another\thing as MyClass; class MyClass {} // fatal error: MyClass conflicts with import statement $a = new MyClass; ?>
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/namespaces/033.php
tests/fixtures/Formatter/out/02-aligned/3rdparty/php-doc/language/namespaces/033.php
<?php namespace foo; use blah\blah as foo; $a = new my\name(); // instantiates "foo\my\name" class foo\bar::name(); // calls static method "name" in class "blah\blah\bar" my\bar(); // calls function "foo\my\bar" $a = my\BAR; // sets $a to the value of constant "foo\my\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/namespaces/038.php
tests/fixtures/Formatter/out/02-aligned/3rdparty/php-doc/language/namespaces/038.php
<?php namespace my\stuff; include 'file1.php'; include 'another.php'; use another\thing as MyClass; $a = new MyClass; // instantiates class "thing" from namespace another ?>
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/namespaces/021.php
tests/fixtures/Formatter/out/02-aligned/3rdparty/php-doc/language/namespaces/021.php
<?php use My\Full\Classname as Another, My\Full\NSname; $obj = new Another; // instantiates object of class My\Full\Classname $obj = new \Another; // instantiates object of class Another $obj = new Another\thing; // instantiates object of class My\Full\Classname\thing $obj = new \Another\thing; // 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/out/02-aligned/3rdparty/php-doc/language/fibers/000.php
tests/fixtures/Formatter/out/02-aligned/3rdparty/php-doc/language/fibers/000.php
<?php $fiber = new Fiber(function (): void { $value = Fiber::suspend('fiber'); echo 'Value used to resume fiber: ', $value, PHP_EOL; }); $value = $fiber->start(); echo 'Value from fiber suspending: ', $value, PHP_EOL; $fiber->resume('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/operators/string/000.php
tests/fixtures/Formatter/out/02-aligned/3rdparty/php-doc/language/operators/string/000.php
<?php $a = 'Hello '; $b = $a . 'World!'; // now $b contains "Hello World!" var_dump($b); $a = 'Hello '; $a .= 'World!'; // now $a contains "Hello World!" 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/out/02-aligned/3rdparty/php-doc/language/operators/logical/000.php
tests/fixtures/Formatter/out/02-aligned/3rdparty/php-doc/language/operators/logical/000.php
<?php // -------------------- // foo() will never get called as those operators are short-circuit $a = (false && foo()); $b = (true || foo()); $c = (false and foo()); $d = (true or foo()); // -------------------- // "||" has a greater precedence than "or" // The result of the expression (false || true) is assigned ...
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/operators/type/006.php
tests/fixtures/Formatter/out/02-aligned/3rdparty/php-doc/language/operators/type/006.php
<?php var_dump(FALSE instanceof stdClass); ?>
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/operators/type/004.php
tests/fixtures/Formatter/out/02-aligned/3rdparty/php-doc/language/operators/type/004.php
<?php interface MyInterface {} class MyClass implements MyInterface {} $a = new MyClass; $b = new MyClass; $c = 'MyClass'; $d = 'NotMyClass'; var_dump($a instanceof $b); // $b is an object of class MyClass var_dump($a instanceof $c); // $c is a string 'MyClass' var_dump($a instanceof $d); // $d is a string 'NotMy...
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/operators/type/001.php
tests/fixtures/Formatter/out/02-aligned/3rdparty/php-doc/language/operators/type/001.php
<?php class ParentClass {} class MyClass extends ParentClass {} $a = new MyClass; var_dump($a instanceof MyClass); var_dump($a instanceof ParentClass); ?>
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/operators/type/002.php
tests/fixtures/Formatter/out/02-aligned/3rdparty/php-doc/language/operators/type/002.php
<?php class MyClass {} $a = new MyClass; var_dump(!($a instanceof stdClass)); ?>
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/operators/type/007.php
tests/fixtures/Formatter/out/02-aligned/3rdparty/php-doc/language/operators/type/007.php
<?php class ClassA extends \stdClass {} class ClassB extends \stdClass {} class ClassC extends ClassB {} class ClassD extends ClassA {} function getSomeClass(): string { return ClassA::class; } var_dump(new ClassA instanceof ('std' . 'Class')); var_dump(new ClassB instanceof ('Class' . 'B')); var_dump(new ClassC...
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/operators/type/003.php
tests/fixtures/Formatter/out/02-aligned/3rdparty/php-doc/language/operators/type/003.php
<?php interface MyInterface {} class MyClass implements MyInterface {} $a = new MyClass; var_dump($a instanceof MyClass); var_dump($a instanceof MyInterface); ?>
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/operators/type/000.php
tests/fixtures/Formatter/out/02-aligned/3rdparty/php-doc/language/operators/type/000.php
<?php class MyClass {} class NotMyClass {} $a = new MyClass; var_dump($a instanceof MyClass); var_dump($a instanceof NotMyClass); ?>
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/operators/type/005.php
tests/fixtures/Formatter/out/02-aligned/3rdparty/php-doc/language/operators/type/005.php
<?php $a = 1; $b = NULL; $c = fopen('/tmp/', 'r'); var_dump($a instanceof stdClass); // $a is an integer var_dump($b instanceof stdClass); // $b is NULL var_dump($c instanceof stdClass); // $c is a resource var_dump(FALSE instanceof stdClass); ?>
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/operators/comparison/006.php
tests/fixtures/Formatter/out/02-aligned/3rdparty/php-doc/language/operators/comparison/006.php
<?php echo 0 ?: 1 ?: 2 ?: 3, PHP_EOL; // 1 echo 0 ?: 0 ?: 2 ?: 3, PHP_EOL; // 2 echo 0 ?: 0 ?: 0 ?: 3, PHP_EOL; // 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/out/02-aligned/3rdparty/php-doc/language/operators/comparison/004.php
tests/fixtures/Formatter/out/02-aligned/3rdparty/php-doc/language/operators/comparison/004.php
<?php // Example usage for: Ternary Operator $action = (empty($_POST['action'])) ? 'default' : $_POST['action']; // The above is identical to this if/else statement if (empty($_POST['action'])) { $action = 'default'; } else { $action = $_POST['action']; } ?>
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/operators/comparison/001.php
tests/fixtures/Formatter/out/02-aligned/3rdparty/php-doc/language/operators/comparison/001.php
<?php // Integers echo 1 <=> 1, ' '; // 0 echo 1 <=> 2, ' '; // -1 echo 2 <=> 1, ' '; // 1 // Floats echo 1.5 <=> 1.5, ' '; // 0 echo 1.5 <=> 2.5, ' '; // -1 echo 2.5 <=> 1.5, ' '; // 1 // Strings echo 'a' <=> 'a', ' '; // 0 echo 'a' <=> 'b', ' '; // -1 echo 'b' <=> 'a', ' '; // 1 echo 'a' <=> 'aa', ' '; ...
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/operators/comparison/002.php
tests/fixtures/Formatter/out/02-aligned/3rdparty/php-doc/language/operators/comparison/002.php
<?php // Bool and null are compared as bool always var_dump(1 == TRUE); // TRUE - same as (bool) 1 == TRUE var_dump(0 == FALSE); // TRUE - same as (bool) 0 == FALSE var_dump(100 < TRUE); // FALSE - same as (bool) 100 < TRUE var_dump(-10 < 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/out/02-aligned/3rdparty/php-doc/language/operators/comparison/009.php
tests/fixtures/Formatter/out/02-aligned/3rdparty/php-doc/language/operators/comparison/009.php
<?php $foo = null; $bar = null; $baz = 1; $qux = 2; echo $foo ?? $bar ?? $baz ?? $qux; // outputs 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/operators/comparison/007.php
tests/fixtures/Formatter/out/02-aligned/3rdparty/php-doc/language/operators/comparison/007.php
<?php // Example usage for: Null Coalesce Operator $action = $_POST['action'] ?? 'default'; // The above is identical to this if/else statement if (isset($_POST['action'])) { $action = $_POST['action']; } else { $action = 'default'; } ?>
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/operators/comparison/003.php
tests/fixtures/Formatter/out/02-aligned/3rdparty/php-doc/language/operators/comparison/003.php
<?php // Arrays are compared like this with standard comparison operators as well as the spaceship operator. function standard_array_compare($op1, $op2) { if (count($op1) < count($op2)) { return -1; // $op1 < $op2 } elseif (count($op1) > count($op2)) { return 1; // $op1 > $op2 } forea...
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/operators/comparison/008.php
tests/fixtures/Formatter/out/02-aligned/3rdparty/php-doc/language/operators/comparison/008.php
<?php // Raises a warning that $name is undefined. print 'Mr. ' . $name ?? 'Anonymous'; // Prints "Mr. Anonymous" print 'Mr. ' . ($name ?? 'Anonymous'); ?>
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/operators/comparison/000.php
tests/fixtures/Formatter/out/02-aligned/3rdparty/php-doc/language/operators/comparison/000.php
<?php var_dump(0 == 'a'); var_dump('1' == '01'); var_dump('10' == '1e1'); var_dump(100 == '1e2'); switch ('a') { case 0: echo '0'; break; case 'a': echo 'a'; break; } ?>
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/operators/comparison/005.php
tests/fixtures/Formatter/out/02-aligned/3rdparty/php-doc/language/operators/comparison/005.php
<?php // on first glance, the following appears to output 'true' echo (true ? 'true' : false ? 't' : 'f'); // however, the actual output of the above is 't' prior to PHP 8.0.0 // this is because ternary expressions are left-associative // the following is a more obvious version of the same code as above 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/out/02-aligned/3rdparty/php-doc/language/operators/errorcontrol/001.php
tests/fixtures/Formatter/out/02-aligned/3rdparty/php-doc/language/operators/errorcontrol/001.php
<?php // this works for any expression, not just functions: $value = @$cache[$key]; // will not issue a notice if the index $key doesn't exist. ?>
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/operators/errorcontrol/000.php
tests/fixtures/Formatter/out/02-aligned/3rdparty/php-doc/language/operators/errorcontrol/000.php
<?php $my_file = @file('non_existent_file') or die("Failed opening file: error was '" . error_get_last()['message'] . "'"); ?>
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/operators/execution/000.php
tests/fixtures/Formatter/out/02-aligned/3rdparty/php-doc/language/operators/execution/000.php
<?php $output = `ls -al`; echo "<pre>$output</pre>"; ?>
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/operators/arithmetic/000.php
tests/fixtures/Formatter/out/02-aligned/3rdparty/php-doc/language/operators/arithmetic/000.php
<?php var_dump(5 % 3); var_dump(5 % -3); var_dump(-5 % 3); var_dump(-5 % -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/out/02-aligned/3rdparty/php-doc/language/operators/assignment/001.php
tests/fixtures/Formatter/out/02-aligned/3rdparty/php-doc/language/operators/assignment/001.php
<?php $a = 3; $a += 5; // sets $a to 8, as if we had said: $a = $a + 5; $b = 'Hello '; $b .= 'There!'; // sets $b to "Hello There!", just like $b = $b . "There!"; 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/out/02-aligned/3rdparty/php-doc/language/operators/assignment/002.php
tests/fixtures/Formatter/out/02-aligned/3rdparty/php-doc/language/operators/assignment/002.php
<?php $a = 3; $b = &$a; // $b is a reference to $a print "$a\n"; // prints 3 print "$b\n"; // prints 3 $a = 4; // change $a print "$a\n"; // prints 4 print "$b\n"; // prints 4 as well, since $b is a reference to $a, which has // been changed ?>
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/operators/assignment/000.php
tests/fixtures/Formatter/out/02-aligned/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/out/02-aligned/3rdparty/php-doc/language/operators/bitwise/001.php
tests/fixtures/Formatter/out/02-aligned/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 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/operators/bitwise/002.php
tests/fixtures/Formatter/out/02-aligned/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 = ...
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/operators/bitwise/000.php
tests/fixtures/Formatter/out/02-aligned/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 --------- --------- -- --------- 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/operators/increment/001.php
tests/fixtures/Formatter/out/02-aligned/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 ...
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/operators/increment/002.php
tests/fixtures/Formatter/out/02-aligned/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/out/02-aligned/3rdparty/php-doc/language/operators/increment/000.php
tests/fixtures/Formatter/out/02-aligned/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/out/02-aligned/3rdparty/php-doc/language/operators/array/001.php
tests/fixtures/Formatter/out/02-aligned/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/out/02-aligned/3rdparty/php-doc/language/operators/array/000.php
tests/fixtures/Formatter/out/02-aligned/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 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/out/02-aligned/3rdparty/php-doc/language/operators/precedence/004.php
tests/fixtures/Formatter/out/02-aligned/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 ...
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/operators/precedence/001.php
tests/fixtures/Formatter/out/02-aligned/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/out/02-aligned/3rdparty/php-doc/language/operators/precedence/002.php
tests/fixtures/Formatter/out/02-aligned/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/out/02-aligned/3rdparty/php-doc/language/operators/precedence/003.php
tests/fixtures/Formatter/out/02-aligned/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/out/02-aligned/3rdparty/php-doc/language/operators/precedence/000.php
tests/fixtures/Formatter/out/02-aligned/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/out/02-aligned/3rdparty/php-doc/language/operators/functional/001.php
tests/fixtures/Formatter/out/02-aligned/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); $temp = 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/operators/functional/000.php
tests/fixtures/Formatter/out/02-aligned/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/out/02-aligned/3rdparty/php-doc/language/types/000.php
tests/fixtures/Formatter/out/02-aligned/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/out/02-aligned/3rdparty/php-doc/language/types/string/018.php
tests/fixtures/Formatter/out/02-aligned/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/out/02-aligned/3rdparty/php-doc/language/types/string/017.php
tests/fixtures/Formatter/out/02-aligned/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/out/02-aligned/3rdparty/php-doc/language/types/string/013.php
tests/fixtures/Formatter/out/02-aligned/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[...
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/string/004.php
tests/fixtures/Formatter/out/02-aligned/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/out/02-aligned/3rdparty/php-doc/language/types/string/022.php
tests/fixtures/Formatter/out/02-aligned/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/out/02-aligned/3rdparty/php-doc/language/types/string/016.php
tests/fixtures/Formatter/out/02-aligned/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/out/02-aligned/3rdparty/php-doc/language/types/string/001.php
tests/fixtures/Formatter/out/02-aligned/3rdparty/php-doc/language/types/string/001.php
<?php // no indentation echo <<<END a b c 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/out/02-aligned/3rdparty/php-doc/language/types/string/011.php
tests/fixtures/Formatter/out/02-aligned/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/out/02-aligned/3rdparty/php-doc/language/types/string/009.php
tests/fixtures/Formatter/out/02-aligned/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/out/02-aligned/3rdparty/php-doc/language/types/string/020.php
tests/fixtures/Formatter/out/02-aligned/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}"; // Work...
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/string/012.php
tests/fixtures/Formatter/out/02-aligned/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/out/02-aligned/3rdparty/php-doc/language/types/string/019.php
tests/fixtures/Formatter/out/02-aligned/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/out/02-aligned/3rdparty/php-doc/language/types/string/014.php
tests/fixtures/Formatter/out/02-aligned/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/out/02-aligned/3rdparty/php-doc/language/types/string/015.php
tests/fixtures/Formatter/out/02-aligned/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/out/02-aligned/3rdparty/php-doc/language/types/string/007.php
tests/fixtures/Formatter/out/02-aligned/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/out/02-aligned/3rdparty/php-doc/language/types/string/010.php
tests/fixtures/Formatter/out/02-aligned/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/out/02-aligned/3rdparty/php-doc/language/types/string/008.php
tests/fixtures/Formatter/out/02-aligned/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 =...
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/string/000.php
tests/fixtures/Formatter/out/02-aligned/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/out/02-aligned/3rdparty/php-doc/language/types/string/021.php
tests/fixtures/Formatter/out/02-aligned/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 th...
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/enumerations/000.php
tests/fixtures/Formatter/out/02-aligned/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/out/02-aligned/3rdparty/php-doc/language/types/float/001.php
tests/fixtures/Formatter/out/02-aligned/3rdparty/php-doc/language/types/float/001.php
<?php $a = 1.23456789; $b = 1.2345678; $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/out/02-aligned/3rdparty/php-doc/language/types/float/000.php
tests/fixtures/Formatter/out/02-aligned/3rdparty/php-doc/language/types/float/000.php
<?php $a = 1.234; $b = 1.2e3; $c = 7.0e-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/out/02-aligned/3rdparty/php-doc/language/types/integer/004.php
tests/fixtures/Formatter/out/02-aligned/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/out/02-aligned/3rdparty/php-doc/language/types/integer/001.php
tests/fixtures/Formatter/out/02-aligned/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/out/02-aligned/3rdparty/php-doc/language/types/integer/002.php
tests/fixtures/Formatter/out/02-aligned/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/out/02-aligned/3rdparty/php-doc/language/types/integer/003.php
tests/fixtures/Formatter/out/02-aligned/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));...
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/integer/000.php
tests/fixtures/Formatter/out/02-aligned/3rdparty/php-doc/language/types/integer/000.php
<?php $a = 1234; // decimal number $a = 0123; // octal number (equivalent to 83 decimal) $a = 0123; // 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...
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/boolean/001.php
tests/fixtures/Formatter/out/02-aligned/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 ...
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/boolean/002.php
tests/fixtures/Formatter/out/02-aligned/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((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/boolean/000.php
tests/fixtures/Formatter/out/02-aligned/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/out/02-aligned/3rdparty/php-doc/language/types/object/001.php
tests/fixtures/Formatter/out/02-aligned/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/out/02-aligned/3rdparty/php-doc/language/types/object/002.php
tests/fixtures/Formatter/out/02-aligned/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/out/02-aligned/3rdparty/php-doc/language/types/object/000.php
tests/fixtures/Formatter/out/02-aligned/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/out/02-aligned/3rdparty/php-doc/language/types/declarations/006.php
tests/fixtures/Formatter/out/02-aligned/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/out/02-aligned/3rdparty/php-doc/language/types/declarations/013.php
tests/fixtures/Formatter/out/02-aligned/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/out/02-aligned/3rdparty/php-doc/language/types/declarations/004.php
tests/fixtures/Formatter/out/02-aligned/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 {} ...
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/001.php
tests/fixtures/Formatter/out/02-aligned/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/out/02-aligned/3rdparty/php-doc/language/types/declarations/002.php
tests/fixtures/Formatter/out/02-aligned/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/out/02-aligned/3rdparty/php-doc/language/types/declarations/011.php
tests/fixtures/Formatter/out/02-aligned/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/out/02-aligned/3rdparty/php-doc/language/types/declarations/009.php
tests/fixtures/Formatter/out/02-aligned/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/out/02-aligned/3rdparty/php-doc/language/types/declarations/012.php
tests/fixtures/Formatter/out/02-aligned/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/out/02-aligned/3rdparty/php-doc/language/types/declarations/014.php
tests/fixtures/Formatter/out/02-aligned/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