php-general Digest 13 Aug 2007 13:30:08 -0000 Issue 4959

Topics (messages 260741 through 260765):

Re: javascript in <head> or in <body> ?
        260741 by: tedd
        260745 by: Robert Cummings

OT Re: [PHP] javascript in <head> or in <body> ?
        260742 by: tedd

PHP Books - A poll of sorts
        260743 by: Jay Blanchard
        260746 by: Robert Cummings
        260747 by: Larry Garfield
        260748 by: Janet Valade
        260753 by: Paul Scott

Re: Concatenation vs. Interpolation
        260744 by: Danial Rahmanzadeh

Strip numerical indices from array
        260749 by: Dave M G
        260752 by: Larry Garfield

phpinfo problem
        260750 by: Rick Knight
        260751 by: Chris

Re: Hidden include_path Fall Back?
        260754 by: Nisse Engström

Re: Strip numerical indices from array [SOLVED]
        260755 by: Dave M G
        260765 by: Larry Garfield

Server Process
        260756 by: Nathan Wallis
        260760 by: Tijnema

apache content negotiation and $_GET
        260757 by: Per Jessen
        260759 by: Per Jessen
        260761 by: Tijnema
        260762 by: Per Jessen
        260763 by: Stut

Re: Friday morning brain farts....
        260758 by: Tijnema

Generating executable code
        260764 by: Chris Boget

Administrivia:

To subscribe to the digest, e-mail:
        [EMAIL PROTECTED]

To unsubscribe from the digest, e-mail:
        [EMAIL PROTECTED]

To post to the list, e-mail:
        [EMAIL PROTECTED]


----------------------------------------------------------------------
--- Begin Message ---
At 1:26 PM -0400 8/11/07, Robert Cummings wrote:
On Sat, 2007-08-11 at 12:15 -0400, tedd wrote:
 > Always (fishing for another apology opportunity) place javascript in
 external files and call them in via the header. Keep the code
 unobtrusive. There are ways to use javascript without having to mix
 it into your html -- look up DOM scripting.

I absolutely agree with unobtrusive JavaScript, but I do disagree with
you slightly on using external files. Generally speaking i keep large
bits of code (Especially libs) in external files, but a few lines of
script for a form that appears on one page I'll often be put in the head
section. This way the JavaScript is in the same file as the template for
which it is associated. My template engine will relocate the JavaScript
to the <head> section at compile time.

That's clever. I assume that for production work (i.e., for a client), you can isolate the files you need and be totally unobtrusive if you want.

I just described my method off-list to another person and it went like this:

I have a system for my site development work such that I simply include one header and one footer and no matter where the project directory is that I'm currently working on, the process will find the one main common header and common footer and will add them to my demo automagically.

My code to start, looks like this:

<?php include('../header.php') ?>
   <h1> Hi </h1>
<?php include('../footer.php') ?>

From there I have a complete page -- from doctype to copyright, it's all there and it validates.

If I need a javascript file locally, then I add it to the local working directory by naming the file "a.js". Likewise, if I need an additional css file, then I name it "a.css" and it's also included in the call.

However, if I don't need those files, then none are included in my local working directory and attempts to load those files will fail -- however -- it doesn't matter if an attempt to load fails or not as long as the files are not needed.

I think that's kind of clever, but I like Rocky and Bullwinkle as well.

Cheers,

tedd

--
-------
http://sperling.com  http://ancientstones.com  http://earthstones.com

--- End Message ---
--- Begin Message ---
On Sun, 2007-08-12 at 21:27 -0400, tedd wrote:
> At 1:26 PM -0400 8/11/07, Robert Cummings wrote:
> >On Sat, 2007-08-11 at 12:15 -0400, tedd wrote:
> >  > Always (fishing for another apology opportunity) place javascript in
> >>  external files and call them in via the header. Keep the code
> >>  unobtrusive. There are ways to use javascript without having to mix
> >>  it into your html -- look up DOM scripting.
> >
> >I absolutely agree with unobtrusive JavaScript, but I do disagree with
> >you slightly on using external files. Generally speaking i keep large
> >bits of code (Especially libs) in external files, but a few lines of
> >script for a form that appears on one page I'll often be put in the head
> >section. This way the JavaScript is in the same file as the template for
> >which it is associated. My template engine will relocate the JavaScript
> >to the <head> section at compile time.
> 
> That's clever. I assume that for production work (i.e., for a 
> client), you can isolate the files you need and be totally 
> unobtrusive if you want.
> 
> I just described my method off-list to another person and it went like this:
> 
> I have a system for my site development work such that I simply 
> include one header and one footer and no matter where the project 
> directory is that I'm currently working on, the process will find the 
> one main common header and common footer and will add them to my demo 
> automagically.
> 
> My code to start, looks like this:
> 
> <?php include('../header.php') ?>
>     <h1> Hi </h1>
> <?php include('../footer.php') ?>
> 
>  From there I have a complete page -- from doctype to copyright, it's 
> all there and it validates.
> 
> If I need a javascript file locally, then I add it to the local 
> working directory by naming the file "a.js". Likewise, if I need an 
> additional css file, then I name it "a.css" and it's also included in 
> the call.
> 
> However, if I don't need those files, then none are included in my 
> local working directory and attempts to load those files will fail -- 
> however -- it doesn't matter if an attempt to load fails or not as 
> long as the files are not needed.
> 
> I think that's kind of clever, but I like Rocky and Bullwinkle as well.

I don't use a script to find my JavaScript files and CSS but I do
something similar to your includes for header and footer. The difference
being that my template engine will pull them in at compile time and not
at run-time. A lot of static content is pulled in this way and relocated
using compile-time accumulators. Then I use run-time accumulators to
flush content at run-time into the appropriate areas if necessary. This
allows me to create a layout that is compiled once at compile time but
with flush hooks for run-time. For instance for simplicity I use the
following tag in the <head> area to set up JavaScript:

<jinn:javaScriptSystem/>

This is the same as doing the following manually:

----------------
<jinn:accumulatorFlush name="javaScriptTags"/>
<jinn:accumulatorFlush name="javaScriptTags" dynamic="true"/>

<jinn:javaScript>
<jinn:accumulatorFlush name="javaScript"/>
<jinn:accumulatorFlush name="javaScript" dynamic="true"/>

    function javaScriptOnLoad()
    {
        <jinn:accumulatorFlush name="javaScriptOnLoad"/>
        <jinn:accumulatorFlush name="javaScriptOnLoad" dynamic="true"/>
    }

</jinn:javaScript>
-----------------

The body tag will have an onload="javaScriptOnLoad()". Then in a content
file I can add the following:

<jinn:accumulate name="javaScriptOnLoad">

    // some javascript code to modify the DOM

</jinn:accumulate>

And it will get relocated at compile time to the location of the static
flush statement: <jinn:accumulatorFlush name="javaScriptOnLoad"/>

Similarly within my code at run-time I can do the following:

$mAcc = &$this->getServiceRef( 'accManager' );
$acc = &$mAcc->getRef( 'javaScriptOnLoad' );

$acc->append
(
    ' // some javascript to modify the DOM '
)

And it will be get flushed into the content at the location of the
dynamic flush statement:

    <jinn:accumulatorFlush name="javaScriptOnLoad" dynamic="true"/>

So all in all, it's very simple for me to put JavaScript (and any
content for that matter) anywhere I please. I often use it for layout
areas (such as left pane, right pane, etc), menus, visitor notices, etc.

BTW if you're wondering why I have a <jinn:javaScript> tag it's because
who wants to remember the following:

---------------------------
<script type="text/javascript"><!--//--><![CDATA[//><!--

//--><!]]></script>
---------------------------

:)

Cheers,
Rob.
-- 
...........................................................
SwarmBuy.com - http://www.swarmbuy.com

    Leveraging the buying power of the masses!
...........................................................

--- End Message ---
--- Begin Message ---
At 10:21 PM +0930 8/12/07, David Robley wrote:
tedd wrote:

 >
 At this rate, by the time I reach the end of my life, I'll know only
 two sentences, namely "I'm sorry" and "Yes, Dear".

Seems to me you could rather easily condense that to just one sentence with
the same degree of functionality. :-)


Unfortunately, it doesn't work that way. You must keep them in two separate sentences.

For example, if your wife says (and you're not listening as usual) "Do these pants make my butt look big?" Neither answer is going to help much. But, if said separately, you at least have a chance of surviving the ordeal.

Cheers,

tedd


--
-------
http://sperling.com  http://ancientstones.com  http://earthstones.com

--- End Message ---
--- Begin Message ---
Evening all! (at least it is evening here in Texas)

We all have our favorite PHP books and resources but there is one tome
that seems to be missing from the group...a "best practices" book. We
all have our preferences for what we call best practices and it seems at
this stage in the life of PHP that there would be a guide to the best of
the best.

I am not talking about the holy wars here (like bracket placement) I am
talking about things like testing variable in conditional situations or
the proper use of constructors or ways to leverage the power of PHP with
databases.

If there was a best practices book would you buy it? (I am showing
complete disregard for the thread on copyright infringement v. theft.)
Or do you rely on other sources like this list, articles, etc to derive
your own set of practices? Thanks for indulging me.

Thanks

Jay

--- End Message ---
--- Begin Message ---
On Sun, 2007-08-12 at 20:52 -0500, Jay Blanchard wrote:
> Evening all! (at least it is evening here in Texas)
> 
> We all have our favorite PHP books and resources but there is one tome
> that seems to be missing from the group...a "best practices" book. We
> all have our preferences for what we call best practices and it seems at
> this stage in the life of PHP that there would be a guide to the best of
> the best.
> 
> I am not talking about the holy wars here (like bracket placement) I am
> talking about things like testing variable in conditional situations or
> the proper use of constructors or ways to leverage the power of PHP with
> databases.
> 
> If there was a best practices book would you buy it? (I am showing
> complete disregard for the thread on copyright infringement v. theft.)
> Or do you rely on other sources like this list, articles, etc to derive
> your own set of practices? Thanks for indulging me.

I don't buy books on tech. I search the web and read what people post
*shrug*. All the knowledge is out there for free. I'm not the type to
need it all bundled up fancy schmancy.

Cheers,
Rob.
-- 
...........................................................
SwarmBuy.com - http://www.swarmbuy.com

    Leveraging the buying power of the masses!
...........................................................

--- End Message ---
--- Begin Message ---
The vast majority of my work these days is done using the Drupal CMS, which 
has its own coding standards and best practices and conventions that are 
(IMO) pretty darned good.  I've adopted most of it in my non-Drupal work, 
too, for simplicity.  

So um, maybe, but I probably wouldn't jump at it as I feel I'm already 
using "good enough practices".

On Sunday 12 August 2007, Jay Blanchard wrote:
> Evening all! (at least it is evening here in Texas)
>
> We all have our favorite PHP books and resources but there is one tome
> that seems to be missing from the group...a "best practices" book. We
> all have our preferences for what we call best practices and it seems at
> this stage in the life of PHP that there would be a guide to the best of
> the best.
>
> I am not talking about the holy wars here (like bracket placement) I am
> talking about things like testing variable in conditional situations or
> the proper use of constructors or ways to leverage the power of PHP with
> databases.
>
> If there was a best practices book would you buy it? (I am showing
> complete disregard for the thread on copyright infringement v. theft.)
> Or do you rely on other sources like this list, articles, etc to derive
> your own set of practices? Thanks for indulging me.
>
> Thanks
>
> Jay


-- 
Larry Garfield                  AIM: LOLG42
[EMAIL PROTECTED]               ICQ: 6817012

"If nature has made any one thing less susceptible than all others of 
exclusive property, it is the action of the thinking power called an idea, 
which an individual may exclusively possess as long as he keeps it to 
himself; but the moment it is divulged, it forces itself into the possession 
of every one, and the receiver cannot dispossess himself of it."  -- Thomas 
Jefferson

--- End Message ---
--- Begin Message ---
Jay Blanchard wrote:

Evening all! (at least it is evening here in Texas)

We all have our favorite PHP books and resources but there is one tome
that seems to be missing from the group...a "best practices" book. We
all have our preferences for what we call best practices and it seems at
this stage in the life of PHP that there would be a guide to the best of
the best.

I am not talking about the holy wars here (like bracket placement) I am
talking about things like testing variable in conditional situations or
the proper use of constructors or ways to leverage the power of PHP with
databases.

If there was a best practices book would you buy it? (I am showing
complete disregard for the thread on copyright infringement v. theft.)
Or do you rely on other sources like this list, articles, etc to derive
your own set of practices? Thanks for indulging me.

Thanks

Jay


I would buy it. But, I buy tons of books.

Janet


--
Janet Valade -- janet.valade.com

--- End Message ---
--- Begin Message ---
On Sun, 2007-08-12 at 20:52 -0500, Jay Blanchard wrote:
> If there was a best practices book would you buy it? (I am showing
> complete disregard for the thread on copyright infringement v. theft.)
> Or do you rely on other sources like this list, articles, etc to derive
> your own set of practices? Thanks for indulging me.

The team that delivers the Chisimba framework (http://avoir.uwc.ac.za),
has also developed our own best practices, as well as documentation
standards and coding standards. These standards are pretty much in line
with most of the large projects out there (I have never needed to look
at Drupal, so I cannot comment there), but I am willing to bet that
there isn't much of a difference.

We publish our coding and doc standards, as well as a bunch of HOWTO's
etc to get started, under a CC BY-SA license, so that if people would
like to adopt that, or build on it, they are free to do so.

I would not mind seeing at least *some* homogeneity in PHP code, across
projects, but I still don't think that *all* projects need stick to the
same standards - this will ultimately stifle creativity, which is what
PHP is all about anyway.

Just my R0.02

--Paul

All Email originating from UWC is covered by disclaimer 
http://www.uwc.ac.za/portal/uwc2006/content/mail_disclaimer/index.htm 

--- End Message ---
--- Begin Message ---
In my opinion, concatenation reduces code readability because unlike
java(that uses + operator), php uses dot(.) for concatenation consider the
following codes:
//java
String mystr="hello"+"world";
is more readable from:
//php
$mystr="hello"."world";

if you only need echoing something to output(which is not usually the case
in MVC and/or other effective methods), the fastest way is using comma:
echo 'hello',$mystr,"blah","blah" ;

--- End Message ---
--- Begin Message ---
PHP General list,

I've got an associative array that also includes a numerical index. The numerical index was automatically generated from the mysql_fetch_array command, so it the values are the duplicates of the associative key names.

Is there a way to simply strip off the numerical index, leaving only the associative key names?

--
Dave M G

--- End Message ---
--- Begin Message ---
There is, but you want to be using mysql_fetch_assoc() instead which gives you 
just the keyed indexes in the first place.

Or, better yet, use mysqli_ or PDO which offer better security than mysql_ if 
you're running PHP 5 (which you are, right? <g>)

On Sunday 12 August 2007, Dave M G wrote:
> PHP General list,
>
> I've got an associative array that also includes a numerical index. The
> numerical index was automatically generated from the mysql_fetch_array
> command, so it the values are the duplicates of the associative key names.
>
> Is there a way to simply strip off the numerical index, leaving only the
> associative key names?
>
> --
> Dave M G


-- 
Larry Garfield                  AIM: LOLG42
[EMAIL PROTECTED]               ICQ: 6817012

"If nature has made any one thing less susceptible than all others of 
exclusive property, it is the action of the thinking power called an idea, 
which an individual may exclusively possess as long as he keeps it to 
himself; but the moment it is divulged, it forces itself into the possession 
of every one, and the receiver cannot dispossess himself of it."  -- Thomas 
Jefferson

--- End Message ---
--- Begin Message --- I have just installed PHP-5.2.3 on my Kubuntu Feisty box. I removed all the debian php first and then compiled php with the options I needed. Now everything seems to be working except phpinfo.php which consists of one line.

<? phpinfo(); ?>


I get a blank screen.

If I delete the php.ini file it get the usual phpinfo output.

php -r "phpinfo();" works as does php -i and my php scripts run fine. What would cause phpinfo.php to not work? It's set rw for the apache2 user so I think the permissions are right. Is there a phpinfo enable/disable in the php.ini? Or in ./configure?

Thanks.
Rick Knight

--- End Message ---
--- Begin Message --- You probably just have short_open_tags set to Off in your php.ini file. If so, either turn it On, or change the file to be:

<?php phpinfo(); ?>

Chris

Rick Knight wrote:
I have just installed PHP-5.2.3 on my Kubuntu Feisty box. I removed all the debian php first and then compiled php with the options I needed. Now everything seems to be working except phpinfo.php which consists of one line.

<? phpinfo(); ?>


I get a blank screen.

If I delete the php.ini file it get the usual phpinfo output.

php -r "phpinfo();" works as does php -i and my php scripts run fine. What would cause phpinfo.php to not work? It's set rw for the apache2 user so I think the permissions are right. Is there a phpinfo enable/disable in the php.ini? Or in ./configure?

Thanks.
Rick Knight


--- End Message ---
--- Begin Message ---
On Thu, 09 Aug 2007 04:08:37 +0800, imacat wrote:

> On Wed, 8 Aug 2007 10:39:03 +0100
> "Ford, Mike" <[EMAIL PROTECTED]> wrote:
>> On 08 August 2007 10:06, imacat wrote:
>>>     I found that include_path seems to have a hidden fall back that's
>>> not documented anywhere.  It seems to always look for files in the
>>> calling files' own directory.
>> Isn't this what's documented here: http://php.net/include/?
> 
>     Oh, Thank you.  I visited that page.  It reads:
> 
>> Files for including are first looked in include_path relative to the
>> current working directory and then in include_path relative to the
>> directory of current script.

   That's funny. When I tried that URL, it (the english
version) says:

  "Files for including are first looked in include_path relative
   to the current working directory and then in the directory of
   the current script."


/Nisse

--- End Message ---
--- Begin Message ---
Larry,

Thank you for responding.
... you want to be using mysql_fetch_assoc() instead...
Thank you, that helps me achieve what I need.

Or, better yet, use mysqli_ ... if you're running PHP 5 (which you are, right?
Yes, I am running PHP 5. However, this mysqli usage is clearly not as simple as replacing every instance of mysql_ with mysqli_.

I will look into it further and see if I can migrate to using mysqli_ somehow.

Thank you for the advice.

--
Dave M G

--- End Message ---
--- Begin Message ---
On Monday 13 August 2007, Dave M G wrote:
> Larry,
>
> Thank you for responding.
>
> > ... you want to be using mysql_fetch_assoc() instead...
>
> Thank you, that helps me achieve what I need.
>
> > Or, better yet, use mysqli_ ... if
> > you're running PHP 5 (which you are, right?
>
> Yes, I am running PHP 5. However, this mysqli usage is clearly not as
> simple as replacing every instance of mysql_ with mysqli_.
>
> I will look into it further and see if I can migrate to using mysqli_
> somehow.

True, it's not.  And actually depending on your use case (shared server, 
dedicated, etc.) PDO may be a better target since PDO is part of a default 
PHP 5 install these days but I don't believe mysqli is.  I'm just pointing 
out that there are better database drivers than mysql_, especially with 
regards to security.  (Prepared statements FTW!)

-- 
Larry Garfield                  AIM: LOLG42
[EMAIL PROTECTED]               ICQ: 6817012

"If nature has made any one thing less susceptible than all others of 
exclusive property, it is the action of the thinking power called an idea, 
which an individual may exclusively possess as long as he keeps it to 
himself; but the moment it is divulged, it forces itself into the possession 
of every one, and the receiver cannot dispossess himself of it."  -- Thomas 
Jefferson

--- End Message ---
--- Begin Message ---
Just a follow up to my post about running an application server side and the
introduction of sockets.

 

My application is really just to modify a series of images on the server and
combine them into a collage of images as a single file name.  So I just say
go and wait for it to build the final file, then it is done.

 

So in this case are sockets an advantage?  I really just want to start the
application and let it go, without transferring data back and forth between
PHP and the app.

 

Any more help would be great.

 

Cheers,

 

Nathan


--- End Message ---
--- Begin Message ---
On 8/13/07, Nathan Wallis <[EMAIL PROTECTED]> wrote:
> Just a follow up to my post about running an application server side and the
> introduction of sockets.
>
>
> My application is really just to modify a series of images on the server and
> combine them into a collage of images as a single file name.  So I just say
> go and wait for it to build the final file, then it is done.
>
>
> So in this case are sockets an advantage?  I really just want to start the
> application and let it go, without transferring data back and forth between
> PHP and the app.
>
>
> Any more help would be great.
>
> Cheers,
>
> Nathan
>

Yes, Sockets are still an advantage, IF you use them correctly, and
use the script behind it correctly. Each program does some things at
startup, like loading DLLs if they weren't loaded already, copying
program into memory etc. which all take resources, and when you run
the program as a service with access through sockets, the program
would run forever, but doesn't need to startup each time.

Tijnema


-- 
Vote for PHP Color Coding in Gmail! -> http://gpcc.tijnema.info

--- End Message ---
--- Begin Message ---
All,

I've got a weird issue concerning $_GET and apaches content negotiation.

situation one:

files in htdocs/:

phpinfo.phtml.en  (all it does is call phpinfo()).
phpinfo.html - apache type-map

if I load URL = https://server/phpinfo?klop=99, I see no _GET variables
listed.  (with the URL, apache will pick the phpinfo.html file, treat
it as a type-map and load phpinfo.phtml.en)

if instead I skip the content negotation, and use URL =
https://server/phpinfo.phtml.en?klop=99, the $_GET variable is
available. 

Any suggestions? 


thanks,
Per Jessen, Zurich

--- End Message ---
--- Begin Message ---
Per Jessen wrote:

> All,
> 
> I've got a weird issue concerning $_GET and apaches content
> negotiation.

I should have mentioned I'm using php 5.2.0 and apache 2.2.3.


/Per Jessen, Zurich

--- End Message ---
--- Begin Message ---
On 8/13/07, Per Jessen <[EMAIL PROTECTED]> wrote:
> All,
>
> I've got a weird issue concerning $_GET and apaches content negotiation.
>
> situation one:
>
> files in htdocs/:
>
> phpinfo.phtml.en  (all it does is call phpinfo()).
> phpinfo.html - apache type-map
>
> if I load URL = https://server/phpinfo?klop=99, I see no _GET variables
> listed.  (with the URL, apache will pick the phpinfo.html file, treat
> it as a type-map and load phpinfo.phtml.en)
>
> if instead I skip the content negotation, and use URL =
> https://server/phpinfo.phtml.en?klop=99, the $_GET variable is
> available.
>
> Any suggestions?
>
>
> thanks,
> Per Jessen, Zurich

This has nothing to do with PHP, and there's only a very little chance
you get a successfull result here.
Your Apache type-map probably just doesn't take the $_GET variables
with it, but don't ask me how to fix ;) I can provide a PHP solution
for it ;)


Tijnema
-- 
Vote for PHP Color Coding in Gmail! -> http://gpcc.tijnema.info

--- End Message ---
--- Begin Message ---
Tijnema wrote:

> This has nothing to do with PHP, and there's only a very little chance
> you get a successfull result here.
> Your Apache type-map probably just doesn't take the $_GET variables
> with it,

Yeah, that is possible - I was wondering whether to blaim PHP or Apache. 
I just thought there was litte risk of apache throwing away the
querystring during content-negotiation.  

I can tell that the $_SERVER[query-string] variable is not set when
using the type-map, but it when I go straight to a specific file.  That
does seem to suggest apache is at fault.


/Per

--- End Message ---
--- Begin Message ---
Per Jessen wrote:
Tijnema wrote:

This has nothing to do with PHP, and there's only a very little chance
you get a successfull result here.
Your Apache type-map probably just doesn't take the $_GET variables
with it,

Yeah, that is possible - I was wondering whether to blaim PHP or Apache. I just thought there was litte risk of apache throwing away the querystring during content-negotiation.
I can tell that the $_SERVER[query-string] variable is not set when
using the type-map, but it when I go straight to a specific file.  That
does seem to suggest apache is at fault.

Actually it suggests exactly that. Apache is giving PHP the query string, and PHP does nothing to it before it puts it in the $_SERVER variable. So this basically means that when you use the type-map Apache is not populating the query string variable.

In short, I'm 5-9's% certain it's Apache that's throwing it away.

-Stut

--
http://stut.net/

--- End Message ---
--- Begin Message ---
On 8/13/07, tedd <[EMAIL PROTECTED]> wrote:
> At 4:54 PM +0200 8/11/07, Tijnema wrote:
> >On 8/11/07, tedd <[EMAIL PROTECTED]> wrote:
> >>  At 7:21 PM +0200 8/10/07, Tijnema wrote:
> >>  >On 8/10/07, Robert Cummings <[EMAIL PROTECTED]> wrote:
> >>  >
> >  > >  > if( !isset( $argv[1] ) || !isset( $argv[2] ) || !isset( $argv[3] ) )
> >>  >
> >  > >if(!isset($argv[1],$argv[2],$argv[3])) // Bit shorter ;)
> >>
> >>  But a bit harder to recognize IMO. :-)
> >>
> >>  Cheers,
> >>
> >>  tedd
> >>  --
> >
> >But less confusing :)
>
> Perhaps for you boy wonder, but for us old farts (or at least me)
> it's a bit more confusing.
>
> I'm going to show my ignorance now -- if I see this:
>
> if( !isset( $argv[1] ) || !isset( $argv[2] ) || !isset( $argv[3] ) )
>
> or this
>
> if( !isset( $argv[1] ) && !isset( $argv[2] ) && !isset( $argv[3] ) )
>
> Then I understand what that means.
>
> But, if I see this:
>
> if(!isset($argv[1],$argv[2],$argv[3])))
>
> My first thought is "Is this OR or AND"? And my second thought is "If
> this is OR, then what's AND?"
>
> Being dyslexic I'm easily confused that way (seriously, that's the
> reason I never use an else-if).
>
> Cheers,
>
> tedd

Well, actually,
if(!isset($argv[1],$argv[2],$argv[3])))
is AND.
As it is the same as this:
if( ! ( isset($argv[1]) && isset($argv[2]) && isset($argv[3]) ) )
Which most of us write
if (!isset($argv[1]) || !isset($argv[2]) || !isset($argv[3]))

All three have the same result ;)

Tijnema
-- 
Vote for PHP Color Coding in Gmail! -> http://gpcc.tijnema.info

--- End Message ---
--- Begin Message ---
Currently, I have an XML file that I load in, parse manually and iterate
through the nodes to create objects, etc, using the node values as
parameters.  This works all well and fine but is a little resource
intensive.

Now, I can create a XSL template to transform the XML file and output
all the PHP code that we are doing manually.  However, when the
transformation occurs, the result is pretty much just a string as far as
PHP is concerned; it isn't executable PHP code.

I know I can output the result to a temporary file then include it or I
can pass the result to eval() to execute the code, but neither is ideal.
Is there another way I can do what I need?  Is there a way to 'include'
(for the lack of a better term) the result of the XSL transformation
such that PHP processes it as it would any other source code?

thnx,
Chris

--- End Message ---

Reply via email to