Re: Is there any sort of preprocessor functionality in PHP4?
- From: Jerry Stuckle <jstucklex@xxxxxxxxxxxxx>
- Date: Thu, 14 Feb 2008 22:03:35 -0500
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
==================
.
- References:
- Is there any sort of preprocessor functionality in PHP4?
- From: Robert K S
- Re: Is there any sort of preprocessor functionality in PHP4?
- From: C. (http://symcbean.blogspot.com/)
- Re: Is there any sort of preprocessor functionality in PHP4?
- From: Robert K S
- Is there any sort of preprocessor functionality in PHP4?
- Prev by Date: Loaded Configuration File (none) ? Why ?
- Next by Date: Re: a tricky one (or not) about form submission
- Previous by thread: Re: Is there any sort of preprocessor functionality in PHP4?
- Next by thread: Re: Is there any sort of preprocessor functionality in PHP4?
- Index(es):
Relevant Pages
|