You are here: Re: Bind variables to a simple array « PHP Programming Language « IT news, forums, messages
Re: Bind variables to a simple array

Posted by Andreas Thiele on 10/29/48 11:23

Janwillem,

thanks for your answer.

"Janwillem Borleffs" <jw@jwscripts.com> schrieb im Newsbeitrag
news:42f6170a$0$30773$dbd4f001@news.euronet.nl...
> ...
> The eval is useless here.
> ...

No, it creates local variables. These were meant to be used in some complex
processing directly following, something like

if ($foo == 3)
if (some_func($bar) == 4 && $baz ==2) ... // I mean a lot of conditions
or other uses following.

The line

return $foo."-".$bar."-".$baz;

only should illustrate, that the example is working correctly.

> ...
> In general, do not use eval because it's quite
> expensive
> ...

I didn't expect this. Are you sure? I mean php is an interpreter, or does it
compile things? If it is a pure interpreter, I would expect the parser
itself using eval a lot. So why should this be especially expensive? Do you
have any hints on something I might read regarding this?

> ...
> The way the test function works now, all you really need is:
>
> function test($arr) {
> return implode('-', $arr);
> }
> ...

Of course, but s. above.

Well, I think I'm somehow misusing the language. It is my own decision how
to create the array. Probably it's better to create the array as array("foo"
=> 1, "bar" => 2, "baz" => 3) and use extract on this.

Andreas

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация