Re: [PHP4BETA] eval - isn´t as slow as rumors about it
| From: | Faisal Nasim | Date: | Sun, 14 May 2000 19:43:45 +0000 |
| Subject: | Re: [PHP4BETA] eval - isn´t as slow as rumors about it | ||
| References: | 1 | Groups: | php.version4 |
| Request: | Send a blank email to php-version4+get-15010@lists.php.net to get a copy of this message | ||
| Hi,
| just a little comment:
| A few posts ago I was worried about being unable to reference in
| variable function calls (like $str="db->fooobj->woo"; $this->$str();).
| But we found out that there´s only the eval() way to do it.
| Eval isn´t as slow as public thinks. I tested now and I use it to fill
| multi-dim (between 2-6 dimensions) arrays based on a condition and I´m
| surprised, it´s fast. Perhaps a small note on eval()´s documentation,
| what eval() actually does and when it´s expected to be slow would help
| some users. I would provide my multi-dim-array-fill code snipplet as an
| advanced use of eval().
The only difference in eval() and regular code is that, the eval()
code is directly read from a string and the rest from file (if not
already read into a string). I haven't checked but I think its
necessary to create a new buffer (yy_create_buffer(), default)
to ask the lexer to parse it from a new location (a _very_ slight
overhead).
Enjoy!
Faisal