php-internal-docs 8.4.8
Unofficial docs for php/php-src
Loading...
Searching...
No Matches
test.php
Go to the documentation of this file.
1<?php
2if (isset($include)) {
3 include (sprintf("%s/web-bootstrap.php", dirname(__FILE__)));
4}
5
6$stdout = fopen("php://stdout", "w+");
7
8class phpdbg {
9 private $sprintf = "%s: %s\n";
10
11 public function isGreat($greeting = null) {
12 printf($this->sprintf, __METHOD__, $greeting);
13 return $this;
14 }
15}
16
17function mine() {
19}
20
21function test($x, $y = 0) {
22 $var = $x + 1;
23 $var += 2;
24 $var <<= 3;
25
26 $foo = function () {
27 echo "bar!\n";
28 };
29
30 $foo();
31
32 yield $var;
33}
34
35$dbg = new phpdbg();
36
38 $dbg->isGreat("PHP Rocks!!"));
39
40foreach (test(1,2) as $gen)
41 continue;
42
43echo "it works!\n";
44
45if (isset($dump))
47
49{
50 echo 'Start';
51 ob_start();
52 echo 'Hello';
53 $b = ob_get_clean();
54 echo 'End';
55 echo $b;
56}
57
59 1,
60 2,
61 [3, 4],
62 [5, 6],
63];
64
65$array[] = 7;
66
67array_walk($array, function (&$item) {
68 if (is_array($item))
69 $item[0] += 2;
70 else
71 $item -= 1;
72});
73
74class testClass {
75 public $a = 2;
76 protected $b = [1, 3];
77 private $c = 7;
78}
79
81
83
84$obj->a += 2;
85$test -= 2;
86
87unset($obj);
is_array(mixed $value)
printf(string $format, mixed ... $values)
dirname(string $path, int $levels=1)
var_dump(mixed $value, mixed ... $values)
fopen(string $filename, string $mode, bool $use_include_path=false, $context=null)
array_walk(array|object &$array, callable $callback, mixed $arg=UNKNOWN)
ob_start($callback=null, int $chunk_size=0, int $flags=PHP_OUTPUT_HANDLER_STDFLAGS)
Definition test.php:8
isGreat($greeting=null)
Definition test.php:11
sprintf("0x%X", $numelems)
$test
Definition test.php:82
mine()
Definition test.php:17
if(isset($include)) $stdout
Definition test.php:6
$obj
Definition test.php:80
phpdbg_test_ob()
Definition test.php:48
$array
Definition test.php:58
$dbg
Definition test.php:35
test($x, $y=0)
Definition test.php:21
if(!defined('PHPDBG_BOOTSTRAPPED')) $_SERVER