Comments on: pecl/operator and Other Neat Stuff http://mikenaberezny.com/2006/02/01/pecloperator/ Wed, 10 Feb 2010 01:29:42 +0000 http://wordpress.org/?v=2.9.2 hourly 1 By: Radek Tetik http://mikenaberezny.com/2006/02/01/pecloperator/comment-page-1/#comment-63420 Radek Tetik Sat, 24 Nov 2007 15:49:43 +0000 http://www.mikenaberezny.com/archives/39#comment-63420 By the "spirit of PHP" you mean PHP should be a simple language for simple tasks? Zend now moves PHP into the enterprise so advanced features should be added to language to be competetive. Operator overloding is a nice feature for string, date and similiar classes. It makes life easier. By the “spirit of PHP” you mean PHP should be a simple language for simple tasks? Zend now moves PHP into the enterprise so advanced features should be added to language to be competetive. Operator overloding is a nice feature for string, date and similiar classes. It makes life easier.

]]>
By: Mike Naberezny http://mikenaberezny.com/2006/02/01/pecloperator/comment-page-1/#comment-292 Mike Naberezny Thu, 02 Feb 2006 03:04:59 +0000 http://www.mikenaberezny.com/archives/39#comment-292 You probably have a great example of this already: the PHAR archive format (PEAR's PHP_Archive: http://pear.php.net/package/php_archive). Your PHP program can write any PHP source code you'd like into a string. This then gets include()d through a stream wrapper (see http://www.php.net/stream_wrapper_register). You can do anything you'd like to the string, including completely generating it at runtime. You can even go so far as to overwrite existing classes (see http://www.php.net/manual/en/function.runkit-import.php) by rewriting the source code for an existing class into a string at runtime, and then feeding the string to runkit_import() through a stream wrapper. You probably have a great example of this already: the PHAR archive format (PEAR’s PHP_Archive: http://pear.php.net/package/php_archive).

Your PHP program can write any PHP source code you’d like into a string. This then gets include()d through a stream wrapper (see http://www.php.net/stream_wrapper_register). You can do anything you’d like to the string, including completely generating it at runtime.

You can even go so far as to overwrite existing classes (see http://www.php.net/manual/en/function.runkit-import.php) by rewriting the source code for an existing class into a string at runtime, and then feeding the string to runkit_import() through a stream wrapper.

]]>
By: Stefano Forenza http://mikenaberezny.com/2006/02/01/pecloperator/comment-page-1/#comment-291 Stefano Forenza Thu, 02 Feb 2006 01:49:49 +0000 http://www.mikenaberezny.com/archives/39#comment-291 Would you post a code example of "some nice tricks by include()ing runtime-generated code through the stream functions." ? Stefano Would you post a code example of
“some nice tricks by include()ing runtime-generated code through the stream functions.” ?

Stefano

]]>