I have the following php code:
index.php
<?php spl_autoload_extensions(".php"); spl_autoload_register(); use modules\standard as std; $handler = new std\handler(); $handler->delegate(); ?>
modules \ standard \ handler.php
<?php namespace modules\standard { class handler { function delegate(){ echo 'Hello from delegation!'; } } } ?>
On Windows 7 running WAMP, the code displays the message "Hello from delegation!". however under linux i get the following:
Fatal error: spl_autoload (): Class modules \ standard \ handler cannot be loaded in /var/www/index.php on line 15
Windows is running PHP 5.3.0 under WAMP, and Linux is running 5.3.2 dotdeb under Ubuntu 9.10.
Is this a configuration problem in my Linux module or is it just different in the way namespaces and startup are handled on different operating systems.
php namespaces autoload
EvilChookie May 19 '10 at 12:40 a.m. 2010-05-19 00:40
source share