|
Posted by Lars Eighner on 05/10/06 19:22
In our last episode,
<1147275327.046931.171850@j33g2000cwa.googlegroups.com>,
the lovely and talented kenoli
broadcast on alt.php:
> Thanks -- That's clear. So, when can one simply insert perl or c code
> into php code and expect it to work?
Well, you can't. You have to check the documentation.
> I doubt it this can be done with
> impunity. How can one know when this can be done?
> Is this also php code and, if so, why isn't it documented at php.net?
I don't know what you mean by "php code." Yes, php has ?:, but I would
guess the code (i.e. source of the php binary) that makes it work is not an
exact snip from C. There isn't much (if anything) in php that is original,
although the implementation may be. If you can find out what language a
particular thing in php is from, you may find the documentation in that
other language is somewhat more helpful than the documentation in php -
although you cannot expect everything that php has borrowed to be fully and
100% accurately implement.
It's in my copy of the manual under III. Language Reference 14. Expressions,
where I learn I did not state the situation precisely:
express1 ? express2 : express3
means the value of express2, if express1 is true, and the value of express3
if express1 is false.
The reason I made this mistake is that express2 and express3 often require
something to be executed in order to be evaluated, and often it is the
side-effect (the execution) that is wanted.
> I've searched far and wide on php.net and other sites and found
> nothing, though I've also noticed that the search engine at php.net
> misses more than it finds.
If you can, download the manual. The index is very helpful on a lot of
stuff (but not this) and it makes a good grep target.
--
Lars Eighner usenet@larseighner.com http://www.larseighner.com/
My mail reader can beat up your mail reader.
Navigation:
[Reply to this message]
|