Thursday, August 27, 2009
Doc Comment could be a source of data!!!
While discussing ways of using PHP as data storage file, we passed over this interesting possibility.
PHP data file: CommentDataClass.php
PHP data file: CommentDataClass.php
/**Retrieving data: Data.php
Doc Comment could be a SOURCE OF DATA
This could be your data in string format!!
*/
class CommentDataClass { }
?>
include_once 'CommentDataClass.php';Well, this is just for fun, we don't recommend it for serious use :)
// Taking advantage of PHP 5.x Reflection,
// Refer: http://in.php.net/oop5.reflection
$reflectedClass = new ReflectionClass('CommentDataClass');
if(preg_match("/\/\*\*(.*)\*\//s",
$reflectedClass->getDocComment(), $matches)) {
$data = $matches[1];
$data = trim($data);
var_dump(explode("\n", $data));
}
?>
Comments:
<< Home
Similar topic discussed at: http://googlecode.blogspot.com/2009/09/gmail-for-mobile-html5-series-reducing.html
Post a Comment
<< Home