Re: Is there any sort of preprocessor functionality in PHP4?



Robert K S wrote:
On Feb 14, 7:40 am, "C. (http://symcbean.blogspot.com/)"
<colin.mckin...@xxxxxxxxx> wrote:
On 13 Feb, 22:58, Robert K S <rober...@xxxxxxxxx> wrote:
Setup: I have a big tree of "if" statements (imagine the PHP code
version of a choose-your-own-adventure story) and I want to be able to
tell which end-branch I've reached. Right now, l have all the end-
branches numbered with integers, and the integer of the end branch is
returned.
Problem: If I insert a new end-branch, I have to laboriously re-number
all the end branches that come after it. As the tree gets larger and
larger, this becomes more and more of a hassle.
This has me wondering if PHP has any functionality that would allow me
to have the engine auto-insert the numbering for me on a pass of the
script that would occur prior to execution. That way I could make the
script just have some sort of ++ deal at each end branch, rather than
assigning the numbers in the script by hard-coding them in.
Alternatively, is there some other way to accomplish the same thing?
Thanks!
Robert K S

Thanks for the advice, Colin. Have you checked out the application?
Writing an inference engine in PHP would be overkill. If there was an
open source solution that I could tinker with, I might look into it.
In the meantime, it's much more cost-effective on my part to keep
polishing the turd. (I'm also not convinced the collection of
questions in the knowledgebase would be any less ungainly than the if-
tree of value comparison conditionals that I already have in place.)

Rob, thanks also for your reply. I hope I'm understanding you're
suggestion correctly, but if I'm not, please set me straight.
array_unshift is a runtime function and so it would only operate on
branches of the if-tree that are reached during execution. I was
hoping that there was some capability in PHP that worked the script
over before runtime.

Robert


Robert,

No, PHP Has no preprocessor.

Of course, you could always use the __LINE__ directive to give the current line number, if all you need to do is relate it back to a specific statement.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@xxxxxxxxxxxxx
==================

.



Relevant Pages

  • Re: Is there any sort of preprocessor functionality in PHP4?
    ... Robert K S wrote: ... version of a choose-your-own-adventure story) and I want to be able to ... If I insert a new end-branch, ... script that would occur prior to execution. ...
    (comp.lang.php)
  • Re: problem with "setlocale"
    ... Why the following script return NULL? ... When I execute 'locale' in my terminal I return the following ... Robert. ...
    (comp.lang.php)
  • Re: problem with "setlocale"
    ... Try using 'pl_PL.utf8' as the locale id. ... Why the following script return NULL? ... Robert. ...
    (comp.lang.php)
  • Re: [PHP] PHP console script vs C/C++/C#
    ... My script is taking a longer time to execute than I want. ... I prefer to write in PHP because that is what I know best. ... This is why I am thinking about rewriting my whole script in a C language. ... Perhaps there are different methods I could be using to speed up execution. ...
    (php.general)
  • Re: How to Add a Feeback Form
    ... I saw nothing in that script that indicates where the form is e-mailed to so ... Greg Maxey/Word MVP ... PHP or not. ... have the support available yet. ...
    (microsoft.public.frontpage.programming)