> From: Tom Boutell [mailto:[email protected]]
>
> That's a good point too.
>
> I think this is a better proposal:
>
> include_code, require_code, and require_code_once would work just like include, require and
> require_once, except that the parser would start out in PHP mode.
>
I don't like this, but it's closer. I hate the idea of adding a whole mess of one-off
functions just to support a single coding style feature that doesn't seem to have very much
support. There are a variety of other ideas that have been floating around that request changes to
how the parser handles specific code (different short tags, sandboxing, auto-escaping, etc.).
What if you have just ONE function with a variety of options? Something like:
execute_file('path/to/foo.php', array(
'require'=>true,
'once'=>true,
'begin_code'=>'<?php ',
'shorttags'=>array('<?=','?>'),
'autoescape'=>function($str){return htmlentities($str, ENT_QUOTES | ENT_HTML5,
'UTF-8');},
...
));
This would provide a single consistent hook for any further DSL like features without impacting the
behavior of any existing code. Some other options that might make sense:
lint (like command line)
end_code (similar to command line, corresponds with begin_code (also command line))
args (also command line)
Any PHP_INI_ALL directives
John Crenshaw
Priacta, Inc.