Startup works on the command line. Pay attention to the mention of "interactive."
PHP , , , php -a .
PHP readline, " ". , .
.
" ". - , , PHP script - , STDIN. . , __autoload() .
( PHP 5.3.2 Linux):
vagrant@lucid32:/etc/apache2$ php -a
Interactive shell
php > function __autoload($classname) {
php { echo "Autoload $classname";
php { eval("class $classname{}");
php { return true;
php { }
php > new Bar();
Autoload ▒▒Bar
php > new FooBar();
Autoload ▒▒FooBar
php > var_dump($a = get_declared_classes());
array(123) {
[0]=>
string(8) "stdClass"
[1]=>
string(9) "Exception"
[2]=>
string(14) "ErrorException"
... lots of internal classes here ...
[121]=>
string(3) "Bar"
[122]=>
string(6) "FooBar"
}
php >
( PHP 5.3.18 Windows)
PS C:\Users\sven> php -a
Interactive mode enabled
<?php
function __autoload($class) { echo "Auto: $class"; eval("class $class {}"); }
echo "Hello World";
$x = new Foo;
var_dump($x);
var_dump($a = get_declared_classes());
^Z
Hello World
Fatal error: Class 'Foo' not found in - on line 4
Call Stack:
100.6337 1114608 1. {main}() -:0