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/predefined/php-incomplete-class/000.php | tests/fixtures/Formatter/out/01-default/3rdparty/php-doc/language/predefined/php-incomplete-class/000.php | <?php
class MyClass
{
public string $property = 'myValue';
}
$myObject = new MyClass;
$foo = serialize($myObject);
// unserializes all objects into __PHP_Incomplete_Class objects
$disallowed = unserialize($foo, ['allowed_classes' => false]);
var_dump($disallowed);
// unserializes all objects into __PHP_Incomp... | php | 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/predefined/countable/count/000.php | tests/fixtures/Formatter/out/01-default/3rdparty/php-doc/language/predefined/countable/count/000.php | <?php
class Counter implements Countable
{
private $count = 0;
public function count(): int
{
return ++$this->count;
}
}
$counter = new Counter;
for ($i = 0; $i < 10; ++$i) {
echo 'I have been count()ed ' . count($counter) . " times\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/predefined/attributes/deprecated/000.PHP74.php | tests/fixtures/Formatter/out/01-default/3rdparty/php-doc/language/predefined/attributes/deprecated/000.PHP74.php | <?php
#[\Deprecated(message: "use safe_replacement() instead", since: "1.5")]
function unsafe_function()
{
echo 'This is unsafe', PHP_EOL;
}
unsafe_function();
?> | php | 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/predefined/attributes/deprecated/000.php | tests/fixtures/Formatter/out/01-default/3rdparty/php-doc/language/predefined/attributes/deprecated/000.php | <?php
#[\Deprecated(message: 'use safe_replacement() instead', since: '1.5')]
function unsafe_function()
{
echo 'This is unsafe', PHP_EOL;
}
unsafe_function();
?> | php | 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/predefined/attributes/sensitiveparameter/000.php | tests/fixtures/Formatter/out/01-default/3rdparty/php-doc/language/predefined/attributes/sensitiveparameter/000.php | <?php
function defaultBehavior(
string $secret,
string $normal
) {
throw new Exception('Error!');
}
function sensitiveParametersWithAttribute(
#[\SensitiveParameter]
string $secret,
string $normal
) {
throw new Exception('Error!');
}
try {
defaultBehavior('password', 'normal');
} cat... | php | 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/predefined/attributes/allowdynamicproperties/000.php | tests/fixtures/Formatter/out/01-default/3rdparty/php-doc/language/predefined/attributes/allowdynamicproperties/000.php | <?php
class DefaultBehaviour {}
#[\AllowDynamicProperties]
class ClassAllowsDynamicProperties {}
$o1 = new DefaultBehaviour();
$o2 = new ClassAllowsDynamicProperties();
$o1->nonExistingProp = true;
$o2->nonExistingProp = 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/predefined/attributes/override/001.php | tests/fixtures/Formatter/out/01-default/3rdparty/php-doc/language/predefined/attributes/override/001.php | <?php
class Base
{
protected string $foo;
}
final class Extended extends Base
{
#[\Override]
protected string $boo;
}
?> | php | 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/predefined/attributes/override/000.php | tests/fixtures/Formatter/out/01-default/3rdparty/php-doc/language/predefined/attributes/override/000.php | <?php
class Base
{
protected function foo(): void {}
}
final class Extended extends Base
{
#[\Override]
protected function boo(): 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/01-default/3rdparty/php-doc/language/predefined/stdclass/001.php | tests/fixtures/Formatter/out/01-default/3rdparty/php-doc/language/predefined/stdclass/001.php | <?php
$json = '{"foo":"bar"}';
var_dump(json_decode($json));
| php | 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/predefined/stdclass/002.php | tests/fixtures/Formatter/out/01-default/3rdparty/php-doc/language/predefined/stdclass/002.php | <?php
$obj = new stdClass();
$obj->foo = 42;
$obj->{1} = 42;
var_dump($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/predefined/stdclass/000.php | tests/fixtures/Formatter/out/01-default/3rdparty/php-doc/language/predefined/stdclass/000.php | <?php
$obj = (object) array('foo' => 'bar');
var_dump($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/predefined/weakreference/000.php | tests/fixtures/Formatter/out/01-default/3rdparty/php-doc/language/predefined/weakreference/000.php | <?php
$obj = new stdClass();
$weakref = WeakReference::create($obj);
var_dump($weakref->get());
unset($obj);
var_dump($weakref->get());
?> | php | 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/predefined/unitenum/cases/000.php | tests/fixtures/Formatter/out/01-default/3rdparty/php-doc/language/predefined/unitenum/cases/000.php | <?php
enum Suit
{
case Hearts;
case Diamonds;
case Clubs;
case Spades;
}
var_dump(Suit::cases());
?> | php | 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/predefined/closure/call/000.php | tests/fixtures/Formatter/out/01-default/3rdparty/php-doc/language/predefined/closure/call/000.php | <?php
class Value
{
protected $value;
public function __construct($value)
{
$this->value = $value;
}
public function getValue()
{
return $this->value;
}
}
$three = new Value(3);
$four = new Value(4);
$closure = function ($delta) {
var_dump($this->getValue() + $delta);... | php | 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/predefined/closure/bind/000.php | tests/fixtures/Formatter/out/01-default/3rdparty/php-doc/language/predefined/closure/bind/000.php | <?php
class A
{
private static $sfoo = 1;
private $ifoo = 2;
}
$cl1 = static function () {
return A::$sfoo;
};
$cl2 = function () {
return $this->ifoo;
};
$bcl1 = Closure::bind($cl1, null, 'A');
$bcl2 = Closure::bind($cl2, new A(), 'A');
echo $bcl1(), "\n";
echo $bcl2(), "\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/predefined/closure/bindto/000.php | tests/fixtures/Formatter/out/01-default/3rdparty/php-doc/language/predefined/closure/bindto/000.php | <?php
class A
{
private $val;
public function __construct($val)
{
$this->val = $val;
}
public function getClosure()
{
// Returns closure bound to this object and scope
return function () {
return $this->val;
};
}
}
$ob1 = new A(1);
$ob2 = 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/predefined/sensitiveparametervalue/getvalue/000.php | tests/fixtures/Formatter/out/01-default/3rdparty/php-doc/language/predefined/sensitiveparametervalue/getvalue/000.php | <?php
$s = new \SensitiveParameterValue('secret');
echo 'The protected value is: ', $s->getValue(), "\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/predefined/sensitiveparametervalue/debuginfo/000.php | tests/fixtures/Formatter/out/01-default/3rdparty/php-doc/language/predefined/sensitiveparametervalue/debuginfo/000.php | <?php
$s = new \SensitiveParameterValue('secret');
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/01-default/3rdparty/php-doc/language/predefined/weakmap/000.php | tests/fixtures/Formatter/out/01-default/3rdparty/php-doc/language/predefined/weakmap/000.php | <?php
$wm = new WeakMap();
$o = new stdClass;
class A
{
public function __destruct()
{
echo "Dead!\n";
}
}
$wm[$o] = new A;
var_dump(count($wm));
echo "Unsetting...\n";
unset($o);
echo "Done\n";
var_dump(count($wm));
| php | 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/predefined/serializable/000.php | tests/fixtures/Formatter/out/01-default/3rdparty/php-doc/language/predefined/serializable/000.php | <?php
class obj implements Serializable
{
private $data;
public function __construct()
{
$this->data = 'My private data';
}
public function serialize()
{
return serialize($this->data);
}
public function unserialize($data)
{
$this->data = unserialize($data);... | php | 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/expressions/001.php | tests/fixtures/Formatter/out/01-default/3rdparty/php-doc/language/expressions/001.php | <?php
$first ? $second : $third
?> | php | 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/expressions/002.php | tests/fixtures/Formatter/out/01-default/3rdparty/php-doc/language/expressions/002.php | <?php
function double($i)
{
return $i * 2;
}
$b = $a = 5; /* assign the value five into the variable $a and $b */
$c = $a++; /* post-increment, assign original value of $a
(5) to $c */
$e = $d = ++$b; /* pre-increment, assign the incremented value of
$b (6) to $d and $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/01-default/3rdparty/php-doc/language/expressions/000.php | tests/fixtures/Formatter/out/01-default/3rdparty/php-doc/language/expressions/000.php | <?php
function foo()
{
return 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/01-default/3rdparty/php-doc/language/functions/028.php | tests/fixtures/Formatter/out/01-default/3rdparty/php-doc/language/functions/028.php | <?php
class Foo
{
function Variable()
{
$name = 'Bar';
$this->$name(); // This calls the Bar() method
}
function Bar()
{
echo 'This is Bar';
}
}
$foo = new Foo();
$funcname = 'Variable';
$foo->$funcname(); // This calls $foo->Variable()
?> | php | 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/functions/031.php | tests/fixtures/Formatter/out/01-default/3rdparty/php-doc/language/functions/031.php | <?php
var_dump(strlen(null));
// "Deprecated: Passing null to parameter #1 ($string) of type string is deprecated" as of PHP 8.1.0
// int(0)
var_dump(str_contains('foobar', null));
// "Deprecated: Passing null to parameter #2 ($needle) of type string is deprecated" as of PHP 8.1.0
// 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/functions/006.php | tests/fixtures/Formatter/out/01-default/3rdparty/php-doc/language/functions/006.php | <?php
function takes_many_args(
$first_arg,
$second_arg,
$a_very_long_argument_name,
$arg_with_default = 5,
$again = 'a default string', // This trailing comma was not permitted before 8.0.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/01-default/3rdparty/php-doc/language/functions/017.php | tests/fixtures/Formatter/out/01-default/3rdparty/php-doc/language/functions/017.php | <?php
function total_intervals($unit, DateInterval ...$intervals)
{
$time = 0;
foreach ($intervals as $interval) {
$time += $interval->$unit;
}
return $time;
}
$a = new DateInterval('P1D');
$b = new DateInterval('P2D');
echo total_intervals('d', $a, $b) . ' days';
// This will fail, since 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/01-default/3rdparty/php-doc/language/functions/013.php | tests/fixtures/Formatter/out/01-default/3rdparty/php-doc/language/functions/013.php | <?php
function makeyogurt($container = 'bowl', $flavour = 'raspberry', $style = 'Greek')
{
return "Making a $container of $flavour $style yogurt.\n";
}
echo makeyogurt(style: 'natural');
?> | php | 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/functions/036.php | tests/fixtures/Formatter/out/01-default/3rdparty/php-doc/language/functions/036.php | <?php
class Test
{
public function testing()
{
return function () {
var_dump($this);
};
}
}
$object = new Test;
$function = $object->testing();
$function();
?> | php | 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/functions/004.php | tests/fixtures/Formatter/out/01-default/3rdparty/php-doc/language/functions/004.php | <?php
function recursion($a)
{
if ($a < 20) {
echo "$a\n";
recursion($a + 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/01-default/3rdparty/php-doc/language/functions/045.php | tests/fixtures/Formatter/out/01-default/3rdparty/php-doc/language/functions/045.php | <?php
$obj?->method(...);
$obj?->prop->method(...);
?> | php | 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/functions/016.php | tests/fixtures/Formatter/out/01-default/3rdparty/php-doc/language/functions/016.php | <?php
function add($a, $b)
{
return $a + $b;
}
echo add(...[1, 2]) . "\n";
$a = [1, 2];
echo add(...$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/functions/001.php | tests/fixtures/Formatter/out/01-default/3rdparty/php-doc/language/functions/001.php | <?php
function foo(
$arg_1,
$arg_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/functions/002.php | tests/fixtures/Formatter/out/01-default/3rdparty/php-doc/language/functions/002.php | <?php
$makefoo = true;
/* We can't call foo() from here
since it doesn't exist yet,
but we can call bar() */
bar();
if ($makefoo) {
function foo()
{
echo "I don't exist until program execution reaches me.\n";
}
}
/* Now we can safely call foo()
since $makefoo evaluated to true */
if (... | php | 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/functions/025.php | tests/fixtures/Formatter/out/01-default/3rdparty/php-doc/language/functions/025.php | <?php
function small_numbers()
{
return [0, 1, 2];
}
// Array destructuring will collect each member of the array individually
[$zero, $one, $two] = small_numbers();
// Prior to 7.1.0, the only equivalent alternative is using list() construct
list($zero, $one, $two) = small_numbers();
?> | php | 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/functions/024.php | tests/fixtures/Formatter/out/01-default/3rdparty/php-doc/language/functions/024.php | <?php
function square($num)
{
return $num * $num;
}
echo square(4); // outputs '16'.
?> | php | 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/functions/032.php | tests/fixtures/Formatter/out/01-default/3rdparty/php-doc/language/functions/032.php | <?php
echo preg_replace_callback('~-([a-z])~', function ($match) {
return strtoupper($match[1]);
}, 'hello-world');
// outputs helloWorld
?> | php | 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/functions/011.php | tests/fixtures/Formatter/out/01-default/3rdparty/php-doc/language/functions/011.php | <?php
function makeyogurt($container = 'bowl', $flavour)
{
return "Making a $container of $flavour yogurt.\n";
}
echo makeyogurt('raspberry'); // "raspberry" is $container, not $flavour
?> | php | 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/functions/009.php | tests/fixtures/Formatter/out/01-default/3rdparty/php-doc/language/functions/009.php | <?php
function makecoffee($types = array('cappuccino'), $coffeeMaker = NULL)
{
$device = is_null($coffeeMaker) ? 'hands' : $coffeeMaker;
return 'Making a cup of ' . join(', ', $types) . " with $device.\n";
}
echo makecoffee();
echo makecoffee(array('cappuccino', 'lavazza'), 'teapot');
?> | php | 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/functions/040.php | tests/fixtures/Formatter/out/01-default/3rdparty/php-doc/language/functions/040.php | <?php
$z = 1;
$fn = fn($x) => fn($y) => $x * $y + $z;
// Outputs 51
var_export($fn(5)(10));
?> | php | 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/functions/020.php | tests/fixtures/Formatter/out/01-default/3rdparty/php-doc/language/functions/020.php | <?php
array_fill(value: 50, count: 100, start_index: 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/01-default/3rdparty/php-doc/language/functions/043.php | tests/fixtures/Formatter/out/01-default/3rdparty/php-doc/language/functions/043.php | <?php
class Foo
{
public function method() {}
public static function staticmethod() {}
public function __invoke() {}
}
$obj = new Foo();
$classStr = 'Foo';
$methodStr = 'method';
$staticmethodStr = 'staticmethod';
$f1 = strlen(...);
$f2 = $obj(...); // invokable object
$f3 = $obj->method(...);
$f4 = $ob... | php | 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/functions/029.php | tests/fixtures/Formatter/out/01-default/3rdparty/php-doc/language/functions/029.php | <?php
class Foo
{
static $variable = 'static property';
static function Variable()
{
echo 'Method Variable called';
}
}
echo Foo::$variable; // This prints 'static property'. It does need a $variable in this scope.
$variable = 'Variable';
Foo::$variable(); // This calls $foo->Variable() read... | php | 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/functions/012.php | tests/fixtures/Formatter/out/01-default/3rdparty/php-doc/language/functions/012.php | <?php
function makeyogurt($flavour, $container = 'bowl')
{
return "Making a $container of $flavour yogurt.\n";
}
echo makeyogurt('raspberry'); // "raspberry" is $flavour
?> | php | 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/functions/019.php | tests/fixtures/Formatter/out/01-default/3rdparty/php-doc/language/functions/019.php | <?php
// Using positional arguments:
array_fill(0, 100, 50);
// Using named arguments:
array_fill(start_index: 0, count: 100, value: 50);
?> | php | 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/functions/014.php | tests/fixtures/Formatter/out/01-default/3rdparty/php-doc/language/functions/014.php | <?php
function foo($a = [], $b) {} // Default not used; deprecated as of PHP 8.0.0
function foo($a, $b) {} // Functionally equivalent, no deprecation notice
function bar(A $a = null, $b) {} // As of PHP 8.1.0, $a is implicitly required
// (because it comes before the required one),
// but implicitly nullable (depre... | php | 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/functions/041.php | tests/fixtures/Formatter/out/01-default/3rdparty/php-doc/language/functions/041.php | <?php
fn(array $x) => $x;
static fn($x): int => $x;
fn($x = 42) => $x;
fn(&$x) => $x;
fn&($x) => $x;
fn($x, ...$rest) => $rest;
?> | php | 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/functions/044.php | tests/fixtures/Formatter/out/01-default/3rdparty/php-doc/language/functions/044.php | <?php
class Foo
{
public function getPrivateMethod()
{
return [$this, 'privateMethod'];
}
private function privateMethod()
{
echo __METHOD__, "\n";
}
}
$foo = new Foo;
$privateMethod = $foo->getPrivateMethod();
$privateMethod();
// Fatal error: Call to private method Foo::priv... | php | 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/functions/037.php | tests/fixtures/Formatter/out/01-default/3rdparty/php-doc/language/functions/037.php | <?php
class Foo
{
function __construct()
{
$func = static function () {
var_dump($this);
};
$func();
}
};
new 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/functions/015.php | tests/fixtures/Formatter/out/01-default/3rdparty/php-doc/language/functions/015.php | <?php
function sum(...$numbers)
{
$acc = 0;
foreach ($numbers as $n) {
$acc += $n;
}
return $acc;
}
echo sum(1, 2, 3, 4);
?> | php | MIT | 5d244a4b7a9b484581edbb5df596a4e76ba17fa6 | 2026-01-05T04:31:39.990954Z | false |
lkrms/pretty-php | https://github.com/lkrms/pretty-php/blob/5d244a4b7a9b484581edbb5df596a4e76ba17fa6/tests/fixtures/Formatter/out/01-default/3rdparty/php-doc/language/functions/007.php | tests/fixtures/Formatter/out/01-default/3rdparty/php-doc/language/functions/007.php | <?php
function add_some_extra(&$string)
{
$string .= 'and something extra.';
}
$str = 'This is a string, ';
add_some_extra($str);
echo $str; // outputs 'This is a string, and something extra.'
?> | php | 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/functions/010.php | tests/fixtures/Formatter/out/01-default/3rdparty/php-doc/language/functions/010.php | <?php
class DefaultCoffeeMaker
{
public function brew()
{
return "Making coffee.\n";
}
}
class FancyCoffeeMaker
{
public function brew()
{
return "Crafting a beautiful coffee just for you.\n";
}
}
function makecoffee($coffeeMaker = new DefaultCoffeeMaker)
{
return $coffeeMa... | php | 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/functions/003.php | tests/fixtures/Formatter/out/01-default/3rdparty/php-doc/language/functions/003.php | <?php
function foo()
{
function bar()
{
echo "I don't exist until foo() is called.\n";
}
}
/* We can't call bar() yet
since it doesn't exist. */
foo();
/* Now we can call bar(),
foo()'s processing has
made it accessible. */
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/functions/023.php | tests/fixtures/Formatter/out/01-default/3rdparty/php-doc/language/functions/023.php | <?php
function foo($a, $b, $c = 3, $d = 4)
{
return $a + $b + $c + $d;
}
var_dump(foo(...[1, 2], d: 40)); // 46
var_dump(foo(...['b' => 2, 'a' => 1], d: 40)); // 46
var_dump(foo(...[1, 2], b: 20)); // Fatal error. Named parameter $b overwrites previous argument
?> | php | 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/functions/026.php | tests/fixtures/Formatter/out/01-default/3rdparty/php-doc/language/functions/026.php | <?php
function &returns_reference()
{
return $someref;
}
$newref = &returns_reference();
?> | php | 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/functions/008.php | tests/fixtures/Formatter/out/01-default/3rdparty/php-doc/language/functions/008.php | <?php
function makecoffee($type = 'cappuccino')
{
return "Making a cup of $type.\n";
}
echo makecoffee();
echo makecoffee(null);
echo makecoffee('espresso');
?> | php | 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/functions/000.php | tests/fixtures/Formatter/out/01-default/3rdparty/php-doc/language/functions/000.php | <?php
function foo($arg_1, $arg_2, /* ..., */ $arg_n)
{
echo "Example function.\n";
return $retval;
}
?> | php | 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/functions/005.php | tests/fixtures/Formatter/out/01-default/3rdparty/php-doc/language/functions/005.php | <?php
$v = foo(
$arg_1,
$arg_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/functions/030.php | tests/fixtures/Formatter/out/01-default/3rdparty/php-doc/language/functions/030.php | <?php
class Foo
{
static function bar()
{
echo "bar\n";
}
function baz()
{
echo "baz\n";
}
}
$func = array('Foo', 'bar');
$func(); // prints "bar"
$func = array(new Foo, 'baz');
$func(); // prints "baz"
$func = 'Foo::bar';
$func(); // prints "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/functions/027.php | tests/fixtures/Formatter/out/01-default/3rdparty/php-doc/language/functions/027.php | <?php
function foo()
{
echo "In foo()<br />\n";
}
function bar($arg = '')
{
echo "In bar(); argument was '$arg'.<br />\n";
}
// This is a wrapper function around echo
function echoit($string)
{
echo $string;
}
$func = 'foo';
$func(); // This calls foo()
$func = 'bar';
$func('test'); // This calls 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/functions/034.php | tests/fixtures/Formatter/out/01-default/3rdparty/php-doc/language/functions/034.php | <?php
$message = 'hello';
// No "use"
$example = function () {
var_dump($message);
};
$example();
// Inherit $message
$example = function () use ($message) {
var_dump($message);
};
$example();
// Inherited variable's value is from when the function
// is defined, not when called
$message = 'world';
$example(... | php | 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/functions/035.php | tests/fixtures/Formatter/out/01-default/3rdparty/php-doc/language/functions/035.php | <?php
// A basic shopping cart which contains a list of added products
// and the quantity of each product. Includes a method which
// calculates the total price of the items in the cart using a
// closure as a callback.
class Cart
{
const PRICE_BUTTER = 1.0;
const PRICE_MILK = 3.0;
const PRICE_EGGS = 6.95;... | php | 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/functions/042.php | tests/fixtures/Formatter/out/01-default/3rdparty/php-doc/language/functions/042.php | <?php
$x = 1;
$fn = fn() => $x++; // Has no effect
$fn();
var_export($x); // 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/01-default/3rdparty/php-doc/language/functions/039.php | tests/fixtures/Formatter/out/01-default/3rdparty/php-doc/language/functions/039.php | <?php
$y = 1;
$fn1 = fn($x) => $x + $y;
// equivalent to using $y by value:
$fn2 = function ($x) use ($y) {
return $x + $y;
};
var_export($fn1(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/01-default/3rdparty/php-doc/language/functions/033.php | tests/fixtures/Formatter/out/01-default/3rdparty/php-doc/language/functions/033.php | <?php
$greet = function ($name) {
printf("Hello %s\r\n", $name);
};
$greet('World');
$greet('PHP');
?> | php | 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/functions/038.php | tests/fixtures/Formatter/out/01-default/3rdparty/php-doc/language/functions/038.php | <?php
$func = static function () {
// function body
};
$func = $func->bindTo(new stdClass);
$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/functions/021.php | tests/fixtures/Formatter/out/01-default/3rdparty/php-doc/language/functions/021.php | <?php
htmlspecialchars($string, double_encode: false);
// Same as
htmlspecialchars($string, ENT_QUOTES | ENT_SUBSTITUTE | ENT_HTML401, 'UTF-8', 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/basic-syntax/006.php | tests/fixtures/Formatter/out/01-default/3rdparty/php-doc/language/basic-syntax/006.php | <?php
echo "This is a test\n"; // This is a one-line c++ style comment
/* This is a multi line comment
yet another line of comment */
echo "This is yet another test\n";
echo "One Final Test\n"; // This is a one-line shell-style comment
?> | php | 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/basic-syntax/004.php | tests/fixtures/Formatter/out/01-default/3rdparty/php-doc/language/basic-syntax/004.php | <?php echo 'Some text'; ?>
No newline
<?= 'But newline now' ?> | php | 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/basic-syntax/001.php | tests/fixtures/Formatter/out/01-default/3rdparty/php-doc/language/basic-syntax/001.php | <?php
echo "Hello world\n";
// ... more code
echo "Last statement\n";
// the script ends here with no PHP closing tag
| php | 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/basic-syntax/002.php | tests/fixtures/Formatter/out/01-default/3rdparty/php-doc/language/basic-syntax/002.php | <p>This is going to be ignored by PHP and displayed by the browser.</p>
<?php echo 'While this is going to be parsed.'; ?>
<p>This will also be ignored by PHP and displayed by the browser.</p> | php | 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/basic-syntax/007.php | tests/fixtures/Formatter/out/01-default/3rdparty/php-doc/language/basic-syntax/007.php | <h1>This is an <?php // echo 'simple'; ?> example</h1>
<p>The header above will say 'This is an example'.</p> | php | 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/basic-syntax/003.php | tests/fixtures/Formatter/out/01-default/3rdparty/php-doc/language/basic-syntax/003.php | <?php if ($expression == true): ?>
This will show if the expression is true.
<?php else: ?>
Otherwise this will show.
<?php endif; ?> | php | 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/basic-syntax/000.php | tests/fixtures/Formatter/out/01-default/3rdparty/php-doc/language/basic-syntax/000.php | 1. <?php echo 'if you want to serve PHP code in XHTML or XML documents,
use these tags'; ?>
2. You can use the short echo tag to <?= 'print this string' ?>.
It's equivalent to <?php echo 'print this string' ?>.
3. <? echo 'this code is within short tags, but will only work '
. 'if short_ope... | php | 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/basic-syntax/005.php | tests/fixtures/Formatter/out/01-default/3rdparty/php-doc/language/basic-syntax/005.php | <?php
echo "This is a test\n";
?>
<?php echo "This is a test\n" ?>
<?php echo "We omitted the last closing tag\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/constants/001.php | tests/fixtures/Formatter/out/01-default/3rdparty/php-doc/language/constants/001.php | <?php
define('CONSTANT', 'Hello world.');
echo CONSTANT; // outputs "Hello world."
echo Constant; // Emits an Error: Undefined constant "Constant"
// Prior to PHP 8.0.0, outputs "Constant" and issues a warning.
?> | php | 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/constants/002.php | tests/fixtures/Formatter/out/01-default/3rdparty/php-doc/language/constants/002.php | <?php
// Simple scalar value
const CONSTANT = 'Hello World';
echo CONSTANT;
// Scalar expression
const ANOTHER_CONST = CONSTANT . '; Goodbye World';
echo ANOTHER_CONST;
const ANIMALS = array('dog', 'cat', 'bird');
echo ANIMALS[1]; // outputs "cat"
// Constant arrays
define('ANIMALS', array(
'dog',
'cat',... | php | 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/constants/000.php | tests/fixtures/Formatter/out/01-default/3rdparty/php-doc/language/constants/000.php | <?php
// Valid constant names
define('FOO', 'something');
define('FOO2', 'something else');
define('FOO_BAR', 'something more');
// Invalid constant names
define('2FOO', 'something');
// This is valid, but should be avoided:
// PHP may one day provide a magical constant
// that will break your script
define('__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/context/socket/000.php | tests/fixtures/Formatter/out/01-default/3rdparty/php-doc/language/context/socket/000.php | <?php
// connect to the internet using the '192.168.0.100' IP
$opts = array(
'socket' => array(
'bindto' => '192.168.0.100:0',
),
);
// connect to the internet using the '192.168.0.100' IP and port '7000'
$opts = array(
'socket' => array(
'bindto' => '192.168.0.100:7000',
),
);
// conn... | php | 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/context/http/001.php | tests/fixtures/Formatter/out/01-default/3rdparty/php-doc/language/context/http/001.php | <?php
$url = 'http://www.example.org/header.php';
$opts = [
'http' => [
'method' => 'GET',
'max_redirects' => '0',
'ignore_errors' => '1',
]
];
$context = stream_context_create($opts);
$stream = fopen($url, 'r', false, $context);
// header information as well as meta data
// about 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/01-default/3rdparty/php-doc/language/context/http/000.php | tests/fixtures/Formatter/out/01-default/3rdparty/php-doc/language/context/http/000.php | <?php
$postdata = http_build_query(
[
'var1' => 'some content',
'var2' => 'doh',
]
);
$opts = [
'http' => [
'method' => 'POST',
'header' => 'Content-type: application/x-www-form-urlencoded',
'content' => $postdata,
]
];
$context = stream_context_create($opts);
... | php | 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/context/zip/000.php | tests/fixtures/Formatter/out/01-default/3rdparty/php-doc/language/context/zip/000.php | <?php
// Read encrypted archive
$opts = array(
'zip' => array(
'password' => 'secret',
),
);
// create the context...
$context = stream_context_create($opts);
// ...and use it to fetch the data
echo file_get_contents('zip://test.zip#test.txt', false, $context);
?> | php | 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/install/pecl/000.php | tests/fixtures/Formatter/out/01-default/3rdparty/php-doc/install/pecl/000.php | <?php
phpinfo();
?> | php | 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/install/macos/bundled/000.php | tests/fixtures/Formatter/out/01-default/3rdparty/php-doc/install/macos/bundled/000.php | <?php phpinfo(); ?> | php | 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/chapters/tutorial/006.php | tests/fixtures/Formatter/out/01-default/3rdparty/php-doc/chapters/tutorial/006.php | Hi <?php echo htmlspecialchars($_POST['name']); ?>.
You are <?php echo (int) $_POST['age']; ?> years old. | php | 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/chapters/tutorial/004.php | tests/fixtures/Formatter/out/01-default/3rdparty/php-doc/chapters/tutorial/004.php | <?php
if (str_contains($_SERVER['HTTP_USER_AGENT'], 'Firefox')) {
echo 'You are using Firefox.';
}
?> | php | 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/chapters/tutorial/001.php | tests/fixtures/Formatter/out/01-default/3rdparty/php-doc/chapters/tutorial/001.php | <!DOCTYPE html>
<html>
<head>
<title>PHP Test</title>
</head>
<body>
<?php echo '<p>Hello World</p>'; ?>
</body>
</html> | php | 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/chapters/tutorial/002.php | tests/fixtures/Formatter/out/01-default/3rdparty/php-doc/chapters/tutorial/002.php | <?php
phpinfo();
?> | php | 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/chapters/tutorial/003.php | tests/fixtures/Formatter/out/01-default/3rdparty/php-doc/chapters/tutorial/003.php | <?php
echo $_SERVER['HTTP_USER_AGENT'];
?> | php | 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/chapters/tutorial/000.php | tests/fixtures/Formatter/out/01-default/3rdparty/php-doc/chapters/tutorial/000.php | <?php
echo 'Hello World!';
?> | php | MIT | 5d244a4b7a9b484581edbb5df596a4e76ba17fa6 | 2026-01-05T04:31:39.990954Z | false |
lkrms/pretty-php | https://github.com/lkrms/pretty-php/blob/5d244a4b7a9b484581edbb5df596a4e76ba17fa6/tests/fixtures/Formatter/out/01-default/3rdparty/php-doc/chapters/tutorial/005.php | tests/fixtures/Formatter/out/01-default/3rdparty/php-doc/chapters/tutorial/005.php | <?php
if (str_contains($_SERVER['HTTP_USER_AGENT'], 'Firefox')) {
?>
<h3>str_contains() returned true</h3>
<p>You are using Firefox</p>
<?php
} else {
?>
<h3>str_contains() returned false</h3>
<p>You are not using Firefox</p>
<?php
}
?> | php | 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/chapters/intro/000.php | tests/fixtures/Formatter/out/01-default/3rdparty/php-doc/chapters/intro/000.php | <!DOCTYPE html>
<html>
<head>
<title>Example</title>
</head>
<body>
<?php
echo "Hi, I'm a PHP script!";
?>
</body>
</html> | php | 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-fig/per-migration2/04800-4.8-function-callable-references.php | tests/fixtures/Formatter/out/01-default/3rdparty/php-fig/per-migration2/04800-4.8-function-callable-references.php | <?php
$callable = $item->doSomething(...);
| php | 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-fig/per-migration2/04600-4.6-modifier-keywords.php | tests/fixtures/Formatter/out/01-default/3rdparty/php-fig/per-migration2/04600-4.6-modifier-keywords.php | <?php
namespace Vendor\Package;
abstract class ClassName
{
protected static readonly string $foo;
final protected int $beep;
abstract protected function zim();
final public static function bar()
{
// method body
}
}
| php | 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-fig/per-migration2/04701-4.7-method-and-function-calls.php | tests/fixtures/Formatter/out/01-default/3rdparty/php-fig/per-migration2/04701-4.7-method-and-function-calls.php | <?php
$someInstance
->create()
->prepare()
->run();
| php | 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-fig/per-migration2/09001-9-enumerations.php | tests/fixtures/Formatter/out/01-default/3rdparty/php-fig/per-migration2/09001-9-enumerations.php | <?php
enum Size
{
case Small;
case Medium;
case Large;
public const Huge = self::Large;
}
| php | 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-fig/per-migration2/05200-5.2-switch-case-match.php | tests/fixtures/Formatter/out/01-default/3rdparty/php-fig/per-migration2/05200-5.2-switch-case-match.php | <?php
$result = match ($a) {
'foo' => 'Foo',
'bar' => 'Bar',
default => 'Baz',
};
| php | MIT | 5d244a4b7a9b484581edbb5df596a4e76ba17fa6 | 2026-01-05T04:31:39.990954Z | false |
lkrms/pretty-php | https://github.com/lkrms/pretty-php/blob/5d244a4b7a9b484581edbb5df596a4e76ba17fa6/tests/fixtures/Formatter/out/01-default/3rdparty/php-fig/per-migration2/02600-2.6-trailing-commas.php | tests/fixtures/Formatter/out/01-default/3rdparty/php-fig/per-migration2/02600-2.6-trailing-commas.php | <?php
$sequence = [1, 2, 3, 5, 8, 13];
function beep(
string $a,
string $b,
string $c,
) {
// ...
}
| php | 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-fig/per-migration2/10000-10-heredoc-and-nowdoc.php | tests/fixtures/Formatter/out/01-default/3rdparty/php-fig/per-migration2/10000-10-heredoc-and-nowdoc.php | <?php
function allowed()
{
$allowedHeredoc = <<<COMPLIANT
This
is
a
compliant
heredoc
COMPLIANT;
$allowedNowdoc = <<<'COMPLIANT'
This
is
a
compliant
nowdoc
COMPLIANT;
var_dump(
'foo',
<<<'COMPLI... | php | 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-fig/per-migration2/04400-4.4-methods-and-functions.php | tests/fixtures/Formatter/out/01-default/3rdparty/php-fig/per-migration2/04400-4.4-methods-and-functions.php | <?php
class SubClass extends BaseClass
{
protected function init() {}
}
| 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.