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/01-default/3rdparty/php-doc/language/variables/013.php | tests/fixtures/Formatter/out/01-default/3rdparty/php-doc/language/variables/013.php | <?php
function test()
{
static $a = 0;
echo $a;
$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/01-default/3rdparty/php-doc/language/variables/022.php | tests/fixtures/Formatter/out/01-default/3rdparty/php-doc/language/variables/022.php | <?php
echo "$a {$$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/01-default/3rdparty/php-doc/language/variables/016.php | tests/fixtures/Formatter/out/01-default/3rdparty/php-doc/language/variables/016.php | <?php
function exampleFunction($input)
{
$result = (static function () use ($input) {
static $counter = 0;
$counter++;
return "Input: $input, Counter: $counter\n";
});
return $result();
}
// Calls to exampleFunction will recreate the anonymous function, so the static
// variable do... | 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/01-default/3rdparty/php-doc/language/variables/002.php | tests/fixtures/Formatter/out/01-default/3rdparty/php-doc/language/variables/002.php | <?php
${'invalid-name'} = 'bar';
$name = 'invalid-name';
echo ${'invalid-name'}, ' ', $$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/01-default/3rdparty/php-doc/language/variables/025.php | tests/fixtures/Formatter/out/01-default/3rdparty/php-doc/language/variables/025.php | <?php
echo $_POST['username'];
echo $_REQUEST['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/01-default/3rdparty/php-doc/language/variables/024.php | tests/fixtures/Formatter/out/01-default/3rdparty/php-doc/language/variables/024.php | <?php
class Foo
{
public $bar = 'I am bar.';
public $arr = ['I am A.', 'I am B.', 'I am C.'];
public $r = 'I am r.';
}
$foo = new Foo();
$bar = 'bar';
$baz = ['foo', 'bar', 'baz', 'quux'];
echo $foo->$bar . "\n";
echo $foo->{$baz[1]} . "\n";
$start = 'b';
$end = 'ar';
echo $foo->{$start . $end} . "\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/01-default/3rdparty/php-doc/language/variables/011.php | tests/fixtures/Formatter/out/01-default/3rdparty/php-doc/language/variables/011.php | <?php
function test_superglobal()
{
echo $_POST['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/01-default/3rdparty/php-doc/language/variables/009.php | tests/fixtures/Formatter/out/01-default/3rdparty/php-doc/language/variables/009.php | <?php
$a = 1;
$b = 2;
function Sum()
{
global $a, $b;
$b = $a + $b;
}
Sum();
echo $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/01-default/3rdparty/php-doc/language/variables/020.php | tests/fixtures/Formatter/out/01-default/3rdparty/php-doc/language/variables/020.php | <?php
$a = 'hello';
?> | 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/01-default/3rdparty/php-doc/language/variables/029.php | tests/fixtures/Formatter/out/01-default/3rdparty/php-doc/language/variables/029.php | <?php
$varname . ext; /* invalid variable 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/01-default/3rdparty/php-doc/language/variables/012.php | tests/fixtures/Formatter/out/01-default/3rdparty/php-doc/language/variables/012.php | <?php
function test()
{
$a = 0;
echo $a;
$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/01-default/3rdparty/php-doc/language/variables/019.php | tests/fixtures/Formatter/out/01-default/3rdparty/php-doc/language/variables/019.php | <?php
function &get_instance_ref()
{
static $obj;
echo 'Static object: ';
var_dump($obj);
if (!isset($obj)) {
$new = new stdClass;
// Assign a reference to the static variable
$obj = &$new;
}
if (!isset($obj->property)) {
$obj->property = 1;
} else {
... | 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/01-default/3rdparty/php-doc/language/variables/014.php | tests/fixtures/Formatter/out/01-default/3rdparty/php-doc/language/variables/014.php | <?php
function test()
{
static $count = 0;
$count++;
echo $count;
if ($count < 10) {
test();
}
$count--;
}
?> | 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/01-default/3rdparty/php-doc/language/variables/015.php | tests/fixtures/Formatter/out/01-default/3rdparty/php-doc/language/variables/015.php | <?php
function foo()
{
static $int = 0; // correct
static $int = 1 + 2; // correct
static $int = sqrt(121); // correct as of PHP 8.3.0
$int++;
echo $int;
}
?> | 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/01-default/3rdparty/php-doc/language/variables/007.php | tests/fixtures/Formatter/out/01-default/3rdparty/php-doc/language/variables/007.php | <?php
$a = 1;
include 'b.inc'; // Variable $a will be available within b.inc
?> | 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/01-default/3rdparty/php-doc/language/variables/010.php | tests/fixtures/Formatter/out/01-default/3rdparty/php-doc/language/variables/010.php | <?php
$a = 1;
$b = 2;
function Sum()
{
$GLOBALS['b'] = $GLOBALS['a'] + $GLOBALS['b'];
}
Sum();
echo $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/01-default/3rdparty/php-doc/language/variables/003.php | tests/fixtures/Formatter/out/01-default/3rdparty/php-doc/language/variables/003.php | <?php
$foo = 'Bob'; // Assign the value 'Bob' to $foo
$bar = &$foo; // Reference $foo via $bar.
$bar = "My name is $bar"; // Alter $bar...
echo $bar;
echo $foo; // $foo is altered too.
?> | 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/01-default/3rdparty/php-doc/language/variables/023.php | tests/fixtures/Formatter/out/01-default/3rdparty/php-doc/language/variables/023.php | <?php
echo "$a $hello";
?> | 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/01-default/3rdparty/php-doc/language/variables/026.php | tests/fixtures/Formatter/out/01-default/3rdparty/php-doc/language/variables/026.php | <?php
if ($_POST) {
echo '<pre>';
echo htmlspecialchars(print_r($_POST, true));
echo '</pre>';
}
?>
<form action="" method="post">
Name: <input type="text" name="personal[name]" /><br />
Email: <input type="text" name="personal[email]" /><br />
Beer: <br />
<select multiple name="beer[]">
... | 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/01-default/3rdparty/php-doc/language/variables/008.php | tests/fixtures/Formatter/out/01-default/3rdparty/php-doc/language/variables/008.php | <?php
$a = 1; // global scope
function test()
{
echo $a; // Variable $a is undefined as it refers to a local version of $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/01-default/3rdparty/php-doc/language/variables/000.php | tests/fixtures/Formatter/out/01-default/3rdparty/php-doc/language/variables/000.php | <?php
$var = 'Bob';
$Var = 'Joe';
echo "$var, $Var"; // outputs "Bob, Joe"
$_4site = 'not yet'; // valid; starts with an underscore
$täyte = 'mansikka'; // valid; 'ä' is (Extended) ASCII 228.
?> | 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/01-default/3rdparty/php-doc/language/variables/005.php | tests/fixtures/Formatter/out/01-default/3rdparty/php-doc/language/variables/005.php | <?php
// Unset AND unreferenced (no use context) variable.
var_dump($unset_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/01-default/3rdparty/php-doc/language/variables/027.php | tests/fixtures/Formatter/out/01-default/3rdparty/php-doc/language/variables/027.php | <?php
setcookie('MyCookie[foo]', 'Testing 1', time() + 3600);
setcookie('MyCookie[bar]', 'Testing 2', time() + 3600);
?> | 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/01-default/3rdparty/php-doc/language/variables/021.php | tests/fixtures/Formatter/out/01-default/3rdparty/php-doc/language/variables/021.php | <?php
$$a = '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/01-default/3rdparty/php-doc/language/references/006.php | tests/fixtures/Formatter/out/01-default/3rdparty/php-doc/language/references/006.php | <?php
/* Assignment of scalar variables */
$a = 1;
$b = &$a;
$c = $b;
$c = 7; // $c is not a reference; no change to $a or $b
/* Assignment of array variables */
$arr = array(1);
$a = &$arr[0]; // $a and $arr[0] are in the same reference set
$arr2 = $arr; // Not an assignment-by-reference!
$arr2[0]++;
/* $a == 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/01-default/3rdparty/php-doc/language/references/013.php | tests/fixtures/Formatter/out/01-default/3rdparty/php-doc/language/references/013.php | <?php
function &collector()
{
static $collection = array();
return $collection;
}
$collection = &collector();
// Now the $collection is a referenced variable that references the static array inside the function
$collection[] = 'foo';
print_r(collector());
// Array
// (
// [0] => 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/01-default/3rdparty/php-doc/language/references/004.php | tests/fixtures/Formatter/out/01-default/3rdparty/php-doc/language/references/004.php | <?php
$ref = 0;
$row = &$ref;
foreach (array(1, 2, 3) as $row) {
// Do something
}
echo $ref; // 3 - last element of the iterated 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/01-default/3rdparty/php-doc/language/references/016.php | tests/fixtures/Formatter/out/01-default/3rdparty/php-doc/language/references/016.php | <?php
$var = &$GLOBALS['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/01-default/3rdparty/php-doc/language/references/001.php | tests/fixtures/Formatter/out/01-default/3rdparty/php-doc/language/references/001.php | <?php
function foo(&$var) {}
foo($a); // $a is "created" and assigned to null
$b = array();
foo($b['b']);
var_dump(array_key_exists('b', $b)); // bool(true)
$c = new stdClass();
foo($c->d);
var_dump(property_exists($c, 'd')); // bool(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/01-default/3rdparty/php-doc/language/references/002.php | tests/fixtures/Formatter/out/01-default/3rdparty/php-doc/language/references/002.php | <?php
$foo = &find_var($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/01-default/3rdparty/php-doc/language/references/011.php | tests/fixtures/Formatter/out/01-default/3rdparty/php-doc/language/references/011.php | <?php
function foo(&$var)
{
$var++;
}
function bar() // Note the missing &
{
$a = 5;
return $a;
}
foo(bar()); // Produces a notice
foo($a = 5); // Expression, not variable
foo(5); // Produces fatal error
class Foobar {}
foo(new Foobar()) // Produces a notice as of PHP 7.0.7
// Notice: Only variab... | 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/01-default/3rdparty/php-doc/language/references/009.php | tests/fixtures/Formatter/out/01-default/3rdparty/php-doc/language/references/009.php | <?php
function foo(&$var)
{
$var++;
}
$a = 5;
foo($a);
// $a is 6 here
?> | 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/01-default/3rdparty/php-doc/language/references/012.php | tests/fixtures/Formatter/out/01-default/3rdparty/php-doc/language/references/012.php | <?php
class Foo
{
public $value = 42;
public function &getValue()
{
return $this->value;
}
}
$obj = new Foo();
$myValue = &$obj->getValue(); // $myValue is a reference to $obj->value, which is 42
$obj->value = 2;
echo $myValue; // Prints the new value of $obj->value, i.e. 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/01-default/3rdparty/php-doc/language/references/014.php | tests/fixtures/Formatter/out/01-default/3rdparty/php-doc/language/references/014.php | <?php
function &collector()
{
static $collection = array();
return $collection;
}
array_push(collector(), '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/01-default/3rdparty/php-doc/language/references/015.php | tests/fixtures/Formatter/out/01-default/3rdparty/php-doc/language/references/015.php | <?php
$a = 1;
$b = &$a;
unset($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/01-default/3rdparty/php-doc/language/references/007.php | tests/fixtures/Formatter/out/01-default/3rdparty/php-doc/language/references/007.php | <?php
function foo(&$var)
{
$var++;
}
$a = 5;
foo($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/01-default/3rdparty/php-doc/language/references/010.php | tests/fixtures/Formatter/out/01-default/3rdparty/php-doc/language/references/010.php | <?php
function foo(&$var)
{
$var++;
}
function &bar()
{
$a = 5;
return $a;
}
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/01-default/3rdparty/php-doc/language/references/003.php | tests/fixtures/Formatter/out/01-default/3rdparty/php-doc/language/references/003.php | <?php
$var1 = 'Example variable';
$var2 = '';
function global_references($use_globals)
{
global $var1, $var2;
if (!$use_globals) {
$var2 = &$var1; // visible only inside the function
} else {
$GLOBALS['var2'] = &$var1; // visible also in global context
}
}
global_references(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/01-default/3rdparty/php-doc/language/references/008.php | tests/fixtures/Formatter/out/01-default/3rdparty/php-doc/language/references/008.php | <?php
function foo(&$var)
{
$var = &$GLOBALS['baz'];
}
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/01-default/3rdparty/php-doc/language/references/000.php | tests/fixtures/Formatter/out/01-default/3rdparty/php-doc/language/references/000.php | <?php
$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/01-default/3rdparty/php-doc/language/references/005.php | tests/fixtures/Formatter/out/01-default/3rdparty/php-doc/language/references/005.php | <?php
$a = 1;
$b = array(2, 3);
$arr = array(&$a, &$b[0], &$b[1]);
$arr[0]++;
$arr[1]++;
$arr[2]++;
/* $a == 2, $b == array(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/01-default/3rdparty/php-doc/language/generators/006.php | tests/fixtures/Formatter/out/01-default/3rdparty/php-doc/language/generators/006.php | <?php
function count_to_ten()
{
yield 1;
yield 2;
yield from [3, 4];
yield from new ArrayIterator([5, 6]);
yield from seven_eight();
yield 9;
yield 10;
}
function seven_eight()
{
yield 7;
yield from eight();
}
function eight()
{
yield 8;
}
foreach (count_to_ten() as $num) {
... | 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/01-default/3rdparty/php-doc/language/generators/004.php | tests/fixtures/Formatter/out/01-default/3rdparty/php-doc/language/generators/004.php | <?php
function &gen_reference()
{
$value = 3;
while ($value > 0) {
yield $value;
}
}
/*
* Note that we can change $number within the loop, and
* because the generator is yielding references, $value
* within gen_reference() changes.
*/
foreach (gen_reference() as &$number) {
echo (--$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/01-default/3rdparty/php-doc/language/generators/001.php | tests/fixtures/Formatter/out/01-default/3rdparty/php-doc/language/generators/001.php | <?php
function gen_one_to_three()
{
for ($i = 1; $i <= 3; $i++) {
// Note that $i is preserved between yields.
yield $i;
}
}
$generator = gen_one_to_three();
foreach ($generator 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/01-default/3rdparty/php-doc/language/generators/002.php | tests/fixtures/Formatter/out/01-default/3rdparty/php-doc/language/generators/002.php | <?php
/*
* The input is semi-colon separated fields, with the first
* field being an ID to use as a key.
*/
$input = <<<'EOF'
1;PHP;Likes dollar signs
2;Python;Likes whitespace
3;Ruby;Likes blocks
EOF;
function input_parser($input)
{
foreach (explode("\n", $input) as $line) {
$fields =... | 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/01-default/3rdparty/php-doc/language/generators/007.php | tests/fixtures/Formatter/out/01-default/3rdparty/php-doc/language/generators/007.php | <?php
function count_to_ten()
{
yield 1;
yield 2;
yield from [3, 4];
yield from new ArrayIterator([5, 6]);
yield from seven_eight();
return yield from nine_ten();
}
function seven_eight()
{
yield 7;
yield from eight();
}
function eight()
{
yield 8;
}
function nine_ten()
{
yiel... | 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/01-default/3rdparty/php-doc/language/generators/003.php | tests/fixtures/Formatter/out/01-default/3rdparty/php-doc/language/generators/003.php | <?php
function gen_three_nulls()
{
foreach (range(1, 3) as $i) {
yield;
}
}
var_dump(iterator_to_array(gen_three_nulls()));
?> | 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/01-default/3rdparty/php-doc/language/generators/008.php | tests/fixtures/Formatter/out/01-default/3rdparty/php-doc/language/generators/008.php | <?php
function getLinesFromFile($fileName)
{
if (!$fileHandle = fopen($fileName, 'r')) {
return;
}
while (false !== $line = fgets($fileHandle)) {
yield $line;
}
fclose($fileHandle);
}
// versus...
class LineIterator implements Iterator
{
protected $fileHandle;
protected ... | 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/01-default/3rdparty/php-doc/language/generators/000.php | tests/fixtures/Formatter/out/01-default/3rdparty/php-doc/language/generators/000.php | <?php
function xrange($start, $limit, $step = 1)
{
if ($start <= $limit) {
if ($step <= 0) {
throw new LogicException('Step must be positive');
}
for ($i = $start; $i <= $limit; $i += $step) {
yield $i;
}
} else {
if ($step >= 0) {
thr... | 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/01-default/3rdparty/php-doc/language/generators/005.php | tests/fixtures/Formatter/out/01-default/3rdparty/php-doc/language/generators/005.php | <?php
function inner()
{
yield 1; // key 0
yield 2; // key 1
yield 3; // key 2
}
function gen()
{
yield 0; // key 0
yield from inner(); // keys 0-2
yield 4; // key 1
}
// pass false as second parameter to get an array [0, 1, 2, 3, 4]
var_dump(iterator_to_array(gen()));
?> | 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/01-default/3rdparty/php-doc/language/namespaces/028.php | tests/fixtures/Formatter/out/01-default/3rdparty/php-doc/language/namespaces/028.php | <?php
$a = new \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/01-default/3rdparty/php-doc/language/namespaces/031.php | tests/fixtures/Formatter/out/01-default/3rdparty/php-doc/language/namespaces/031.php | <?php
namespace foo;
class MyClass {}
// using a class from the current namespace as a parameter type
function test(MyClass $parameter_type_example = null) {}
// another way to use a class from the current namespace as a parameter type
function test(\foo\MyClass $parameter_type_example = null) {}
// extending a clas... | 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/01-default/3rdparty/php-doc/language/namespaces/006.php | tests/fixtures/Formatter/out/01-default/3rdparty/php-doc/language/namespaces/006.php | <?php
namespace MyProject
{
const CONNECT_OK = 1;
class Connection
{ /* ... */
}
function connect()
{ /* ... */
}
}
namespace
{ // global code
session_start();
$a = MyProject\connect();
echo MyProject\Connection::start();
}
?> | 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/01-default/3rdparty/php-doc/language/namespaces/018.php | tests/fixtures/Formatter/out/01-default/3rdparty/php-doc/language/namespaces/018.php | <?php
namespace foo;
use My\Full\Classname as Another;
// this is the same as use My\Full\NSname as NSname
use My\Full\NSname;
// importing a global class
use ArrayObject;
// importing a function
use function My\Full\functionName;
// aliasing a function
use function My\Full\functionName as func;
// importing a const... | 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/01-default/3rdparty/php-doc/language/namespaces/017.php | tests/fixtures/Formatter/out/01-default/3rdparty/php-doc/language/namespaces/017.php | <?php
namespace\func(); // calls function func()
namespace\sub\func(); // calls function sub\func()
namespace\cname::method(); // calls static method "method" of class cname
$a = new namespace\sub\cname(); // instantiates object of class sub\cname
$b = namespace\CONSTANT; // assigns value of constant CONSTANT to ... | 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/01-default/3rdparty/php-doc/language/namespaces/013.php | tests/fixtures/Formatter/out/01-default/3rdparty/php-doc/language/namespaces/013.php | <?php
namespace MyProject;
echo '"', __NAMESPACE__, '"'; // outputs "MyProject"
?> | 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/01-default/3rdparty/php-doc/language/namespaces/036.php | tests/fixtures/Formatter/out/01-default/3rdparty/php-doc/language/namespaces/036.php | <?php
namespace my\stuff;
class 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/01-default/3rdparty/php-doc/language/namespaces/004.php | tests/fixtures/Formatter/out/01-default/3rdparty/php-doc/language/namespaces/004.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/01-default/3rdparty/php-doc/language/namespaces/016.php | tests/fixtures/Formatter/out/01-default/3rdparty/php-doc/language/namespaces/016.php | <?php
namespace MyProject;
use blah\blah as mine; // see "Using namespaces: Aliasing/Importing"
blah\mine(); // calls function MyProject\blah\mine()
namespace\blah\mine(); // calls function MyProject\blah\mine()
namespace\func(); // calls function MyProject\func()
namespace\sub\func(); // calls function MyProje... | 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/01-default/3rdparty/php-doc/language/namespaces/001.php | tests/fixtures/Formatter/out/01-default/3rdparty/php-doc/language/namespaces/001.php | <?php
namespace MyProject;
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/01-default/3rdparty/php-doc/language/namespaces/002.php | tests/fixtures/Formatter/out/01-default/3rdparty/php-doc/language/namespaces/002.php | <html>
<?php
namespace MyProject; // fatal error - namespace must be the first statement in the script
?> | 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/01-default/3rdparty/php-doc/language/namespaces/025.php | tests/fixtures/Formatter/out/01-default/3rdparty/php-doc/language/namespaces/025.php | <?php
namespace A\B\C;
class Exception extends \Exception {}
$a = new Exception('hi'); // $a is an object of class A\B\C\Exception
$b = new \Exception('hi'); // $b is an object of class Exception
$c = new ArrayObject; // fatal error, class A\B\C\ArrayObject not found
?> | 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/01-default/3rdparty/php-doc/language/namespaces/024.php | tests/fixtures/Formatter/out/01-default/3rdparty/php-doc/language/namespaces/024.php | <?php
namespace A\B\C;
/* This function is A\B\C\fopen */
function fopen()
{
/* ... */
$f = \fopen(...); // call global fopen
return $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/01-default/3rdparty/php-doc/language/namespaces/032.php | tests/fixtures/Formatter/out/01-default/3rdparty/php-doc/language/namespaces/032.php | <?php
namespace foo;
$a = new \my\name(); // instantiates "my\name" class
echo \strlen('hi'); // calls function "strlen"
$a = \INI_ALL; // $a is set to the value of constant "INI_ALL"
?> | 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/01-default/3rdparty/php-doc/language/namespaces/011.php | tests/fixtures/Formatter/out/01-default/3rdparty/php-doc/language/namespaces/011.php | <?php
class classname
{
function __construct()
{
echo __METHOD__, "\n";
}
}
function funcname()
{
echo __FUNCTION__, "\n";
}
const constname = 'global';
$a = 'classname';
$obj = new $a; // prints classname::__construct
$b = 'funcname';
$b(); // prints funcname
echo constant('constname'), "\... | 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/01-default/3rdparty/php-doc/language/namespaces/009.php | tests/fixtures/Formatter/out/01-default/3rdparty/php-doc/language/namespaces/009.php | <?php
namespace Foo\Bar;
include 'file1.php';
const FOO = 2;
function foo() {}
class foo
{
static function staticmethod() {}
}
/* Unqualified name */
foo(); // resolves to function Foo\Bar\foo
foo::staticmethod(); // resolves to class Foo\Bar\foo, method staticmethod
echo FOO; // resolves to constant Foo\Ba... | 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/01-default/3rdparty/php-doc/language/namespaces/040.php | tests/fixtures/Formatter/out/01-default/3rdparty/php-doc/language/namespaces/040.php | <?php
namespace my\stuff
{
namespace nested
{
class 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/01-default/3rdparty/php-doc/language/namespaces/020.php | tests/fixtures/Formatter/out/01-default/3rdparty/php-doc/language/namespaces/020.php | <?php
use My\Full\Classname as Another, My\Full\NSname;
$obj = new Another; // instantiates object of class My\Full\Classname
$a = 'Another';
$obj = new $a; // instantiates object of class 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/01-default/3rdparty/php-doc/language/namespaces/043.php | tests/fixtures/Formatter/out/01-default/3rdparty/php-doc/language/namespaces/043.php | <?php
namespace bar;
$a = FOO; // produces notice - undefined constants "FOO" assumed "FOO";
$a = \FOO; // fatal error, undefined namespace constant FOO
$a = Bar\FOO; // fatal error, undefined namespace constant bar\Bar\FOO
$a = \Bar\FOO; // fatal error, undefined namespace constant Bar\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/01-default/3rdparty/php-doc/language/namespaces/029.php | tests/fixtures/Formatter/out/01-default/3rdparty/php-doc/language/namespaces/029.php | <?php
$a = new 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/01-default/3rdparty/php-doc/language/namespaces/012.php | tests/fixtures/Formatter/out/01-default/3rdparty/php-doc/language/namespaces/012.php | <?php
namespace namespacename;
class classname
{
function __construct()
{
echo __METHOD__, "\n";
}
}
function funcname()
{
echo __FUNCTION__, "\n";
}
const constname = 'namespaced';
/* note that if using double quotes, "\\namespacename\\classname" must be used */
$a = '\namespacename\classna... | 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/01-default/3rdparty/php-doc/language/namespaces/019.php | tests/fixtures/Formatter/out/01-default/3rdparty/php-doc/language/namespaces/019.php | <?php
use My\Full\Classname as Another, My\Full\NSname;
$obj = new Another; // instantiates object of class My\Full\Classname
NSname\subns\func(); // calls function My\Full\NSname\subns\func
?> | 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/01-default/3rdparty/php-doc/language/namespaces/014.php | tests/fixtures/Formatter/out/01-default/3rdparty/php-doc/language/namespaces/014.php | <?php
echo '"', __NAMESPACE__, '"'; // 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/01-default/3rdparty/php-doc/language/namespaces/041.php | tests/fixtures/Formatter/out/01-default/3rdparty/php-doc/language/namespaces/041.php | <?php
namespace my\stuff\nested
{
class 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/01-default/3rdparty/php-doc/language/namespaces/044.php | tests/fixtures/Formatter/out/01-default/3rdparty/php-doc/language/namespaces/044.php | <?php
namespace bar;
const NULL = 0; // fatal error;
const true = 'stupid'; // also fatal error;
// 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/01-default/3rdparty/php-doc/language/namespaces/037.php | tests/fixtures/Formatter/out/01-default/3rdparty/php-doc/language/namespaces/037.php | <?php
namespace another;
class thing {}
?> | 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/01-default/3rdparty/php-doc/language/namespaces/015.php | tests/fixtures/Formatter/out/01-default/3rdparty/php-doc/language/namespaces/015.php | <?php
namespace MyProject;
function get($classname)
{
$a = __NAMESPACE__ . '\\' . $classname;
return 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/01-default/3rdparty/php-doc/language/namespaces/007.php | tests/fixtures/Formatter/out/01-default/3rdparty/php-doc/language/namespaces/007.php | <?php declare(encoding='UTF-8');
namespace MyProject
{
const CONNECT_OK = 1;
class Connection
{ /* ... */
}
function connect()
{ /* ... */
}
}
namespace
{ // global code
session_start();
$a = MyProject\connect();
echo MyProject\Connection::start();
}
?> | 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/01-default/3rdparty/php-doc/language/namespaces/010.php | tests/fixtures/Formatter/out/01-default/3rdparty/php-doc/language/namespaces/010.php | <?php
namespace Foo;
function strlen() {}
const INI_ALL = 3;
class Exception {}
$a = \strlen('hi'); // calls global function strlen
$b = \INI_ALL; // accesses global constant INI_ALL
$c = new \Exception('error'); // instantiates global class 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/01-default/3rdparty/php-doc/language/namespaces/003.php | tests/fixtures/Formatter/out/01-default/3rdparty/php-doc/language/namespaces/003.php | <?php
namespace MyProject\Sub\Level;
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/01-default/3rdparty/php-doc/language/namespaces/023.php | tests/fixtures/Formatter/out/01-default/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/01-default/3rdparty/php-doc/language/namespaces/026.php | tests/fixtures/Formatter/out/01-default/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";
} el... | 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/01-default/3rdparty/php-doc/language/namespaces/008.php | tests/fixtures/Formatter/out/01-default/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/01-default/3rdparty/php-doc/language/namespaces/000.php | tests/fixtures/Formatter/out/01-default/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
$d = namespace\MYCO... | 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/01-default/3rdparty/php-doc/language/namespaces/005.php | tests/fixtures/Formatter/out/01-default/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/01-default/3rdparty/php-doc/language/namespaces/030.php | tests/fixtures/Formatter/out/01-default/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/01-default/3rdparty/php-doc/language/namespaces/027.php | tests/fixtures/Formatter/out/01-default/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" defined... | 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/01-default/3rdparty/php-doc/language/namespaces/034.php | tests/fixtures/Formatter/out/01-default/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/01-default/3rdparty/php-doc/language/namespaces/035.php | tests/fixtures/Formatter/out/01-default/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 "foo\strlen" does no... | 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/01-default/3rdparty/php-doc/language/namespaces/042.php | tests/fixtures/Formatter/out/01-default/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/01-default/3rdparty/php-doc/language/namespaces/039.php | tests/fixtures/Formatter/out/01-default/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/01-default/3rdparty/php-doc/language/namespaces/033.php | tests/fixtures/Formatter/out/01-default/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/01-default/3rdparty/php-doc/language/namespaces/038.php | tests/fixtures/Formatter/out/01-default/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/01-default/3rdparty/php-doc/language/namespaces/021.php | tests/fixtures/Formatter/out/01-default/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; // instantiates obj... | 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/01-default/3rdparty/php-doc/language/fibers/000.php | tests/fixtures/Formatter/out/01-default/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/01-default/3rdparty/php-doc/language/operators/string/000.php | tests/fixtures/Formatter/out/01-default/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/01-default/3rdparty/php-doc/language/operators/logical/000.php | tests/fixtures/Formatter/out/01-default/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/01-default/3rdparty/php-doc/language/operators/type/006.php | tests/fixtures/Formatter/out/01-default/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/01-default/3rdparty/php-doc/language/operators/type/004.php | tests/fixtures/Formatter/out/01-default/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/01-default/3rdparty/php-doc/language/operators/type/001.php | tests/fixtures/Formatter/out/01-default/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 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.