Justtechjobs.com Find a programming school near you






Online Campus Both


php3-list | 2000051

Re: [PHP3] XML functions From: Saurabh Gupta (error <email protected>)
Date: 04/08/00

Thanks!!!

I've finally managed to get it to work :-)

Saurabh

Jean-Marc Libs wrote:

> On Fri, 7 Apr 2000, Saurabh Gupta wrote:
>
> Hi
>
> > Could someone please explain the following piece of code from the PHP
> > Manual
> >
> > if ($htmltag = $map_array[$name]) {
> > print "<$htmltag>";
> > }
> >
> > 1. where does $htmltag come from
> > 2. what is $map_array[$name] and
> > 3. shouldn't there not be == instead of =
>
> if ($htmltag = $map_array[$name]) {
> print "<$htmltag>";
> }
>
> is just a short way of typing
>
> $htmltag = $map_array[$name];
> if ($htmltag) {
> print "<$htmltag>";
> }
>
> It all revolves around the notion of operator priority.
> So, what happens is, the expression $htmltag = $map_array[$name] is
> evaluated before the "if". This gives a value to the variable $htmltag
> (answer to your first question).
> What value ? The value of $map_array[$name]. The value of $map_array[$name]
> depends on the value of $name. According to the definition of your array,
> the values are as follows:
> if $name is BOLD, $map_array[$name] is B
> if $name is EMPHASIS, $map_array[$name] is I
> if $name is LITERAL, $map_array[$name] is TT
> if $name is anything else, $map_array[$name] is nothing.
> Now we know the value of $htmltag. Some times it has a value, sometimes
> it does not.
> So, the "if" statement is evaluated now, and it is the same as
> if ($htmltag)
> It enters the if statement only when $htmltag is either B, I or TT
> otherwise, it writes nothing
>
> This what the code above does, but I don't know how the full code works
> with these BOLD tags :-(
>
> I played with it at http://libs.free.fr/xml/parse.php3 and I never get
> anything in bold. Anyway, the xml parsing proper works.
>
> Hop this helps,
> Jean-Marc Libs
>
> --
> Les Journées du Logiciel Libre les 12 et 13 mai à Strasbourg :
> http://strasbourg.linuxfr.org/jl3 (demo PHP à gauche en entrant!)
>
> "Linux means never having to delete your love mail." -- Don Marti

-- 
PHP 3 Mailing List <http://www.php.net/>
To unsubscribe, send an empty message to php3-unsubscribe <email protected>
To subscribe to the digest, e-mail: php3-digest-subscribe <email protected>
To search the mailing list archive, go to: http://www.php.net/mailsearch.php3
To contact the list administrators, e-mail: php-list-admin <email protected>