Re: [PHP4BETA] Include-like on strings

From: Date: Wed, 08 Mar 2000 12:04:37 +0000
Subject: Re: [PHP4BETA] Include-like on strings
References: 1 2 3  Groups: php.version4 
Request: Send a blank email to php-version4+get-11743@lists.php.net to get a copy of this message
: Hi, : : > > In my eyes this is not a very senseful construct, cause once implemented : > > it would be used for things which can be implemented in another way much : > > cleaner. There is no "must" for such a function. : > : > I want to write mixed HTML and PHP code and save it into database, not : > in files. What is THE RIGHT way? : : As far as I can tell, there is no function for : this! : : You may want to checkout include() and family : and write your own function which does this. : It will be easy if include() (require() or : other) reads the file first and then parse : it throught the bison parser... send a patch : if you are successful. <cut> : P.S. I'll give it a try tomorrow! Okay, that tomorrow is today, and I couldn't work it out! I tried to make it but ended in two different types of eval() implementation..... first one was independant of compile_string() and prepare_string() (zend-parser.y), as I didn't know that they existed! I messed alot with the yacc/bison grammar, lexer etc..... :-) Both worked fine, but the only problem is they work like eval.... But, after some time, I thought for this: How does this look: <? eval ( "?><? print 'cool'; ?>" ); print "awesome!"; ?> That is: eval ( "?> YOUR FORMATTED PHP CODE" ); Because this produces error: <? <? print "cool"; ?> ?> # this doesn't matter Enjoy! P.S. While working on the internals, I think I have caught a bug, going to post it through bug report page....

« previous php.version4 (#11743) next »