summaryrefslogtreecommitdiff
path: root/tests/examplefiles/psysh/psysh_test.psysh
blob: 4ab9b134569bba22b4008c7511da9363903952b0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
>>> (int) 10.88
=> 10
>>> (string) 10.88
=> "10.88"
>>> (bool) 10.88
=> true
>>> (array) 10.88
=> [
     10.88,
   ]
>>> $object = (object) 10.88
=> {#2373
     +"scalar": 10.88,
   }
>>> $object->scalar
=> 10.88
>>> $fileHandle = fopen('hello.txt', 'w');
=> stream resource #400
>>> (int) $fileHandle
=> 400
>>> (string) $fileHandle
=> "Resource id #400"
>>> $greeting = 'Hello!';
=> "Hello!"
>>> $_greeting = 'Hello!';
=> "Hello!"
>>> $gruß = 'Hallo!';
=> "Hallo!"
>>> namespace Foo\Bar;
>>> class Baz {
...     public function getBaz(): string {
...         return 'baz';
...     }
... }
>>> $baz = new Foo\Bar\Baz();
PHP Fatal error:  Class 'Foo/Bar/Foo/Bar/Baz' not
    found in Psy Shell code on line 1
>>> $baz = new Baz();
=> Foo\Bar\Baz {#2382}
>>> $baz->getBaz();
=> "baz"
>>> $greeting = function($name): string {
...     return "Hello, {$name}";
... };
=> Closure($name): string {#2371 …3}
>>> $greeting('World')
=> "Hello, World"