php-general Digest 29 Sep 2010 13:01:53 -0000 Issue 6965
Topics (messages 308348 through 308352):
Re: SimpleXML/array duality (like particles & waves)
308348 by: Nathan Nobbe
308349 by: Brian Dunning
308350 by: Nathan Nobbe
308352 by: Erik L. Arneson
Re: if/elseif being treated as if/if
308351 by: Neville Dempsey
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 ---
On Tue, Sep 28, 2010 at 4:29 PM, Brian Dunning <[email protected]>wrote:
> I am kind of jacked here. I have a SimpleXML object that's been converted
> to an array.
how was the SimpleXMLElement converted to an array?
-nathan
--- End Message ---
--- Begin Message ---
If you read down to the bottom of the post, the function I used is given.
On Sep 28, 2010, at 3:47 PM, Nathan Nobbe wrote:
> On Tue, Sep 28, 2010 at 4:29 PM, Brian Dunning <[email protected]> wrote:
> I am kind of jacked here. I have a SimpleXML object that's been converted to
> an array.
>
> how was the SimpleXMLElement converted to an array?
>
> -nathan
--- End Message ---
--- Begin Message ---
On Tue, Sep 28, 2010 at 5:06 PM, Brian Dunning <[email protected]>wrote:
> If you read down to the bottom of the post, the function I used is given.
My apologies for the hasty response. well, if i had to guess, id say thats
where the problem is. why cant you just iterate over the object w/ the
built in functionality, which is to say, why bother converting to an array
in the first place?
-nathan
--- End Message ---
--- Begin Message ---
On Tue, 28 Sep 2010, Brian Dunning wrote:
> I am kind of jacked here. I have a SimpleXML object that's been
> converted to an array. In one of the nodes, for no reason I can see,
> the array is populated differently if there is only one <order_item>
> than if there are multiple <order_item>s.
>
> [...]
>
> In case it matters, here is that snip of what the original XML looks
> like, it's all good:
> <?xml version="1.0" encoding="UTF-8"?>
> <order xmlns="http://xxxx.com/xxxx" version="1.0">
> <order_items>
> <order_item>
> <order_item_product_code finish="glossy">1060</order_item_product_code>
> <order_item_description>4x5.3 trueDigital
> print(s)</order_item_description>
> </order_item>
> <order_item>
> <order_item_product_code finish="glossy">1300</order_item_product_code>
> <order_item_description>4x8 photo cards (set of
> 20)</order_item_description>
> </order_item>
> </order_items>
> </order>
What does the XML look like if there's only one order item? Maybe
you're losing a level of nesting there?
--
Erik Arneson <[email protected]>
GPG Key ID : 1024D/62DA1D25 BitCoin : 1LqvuGUqJ4ZUSoE7YE9ngETjwp4yZ2uSdP
Office : +1.541.291.9776 Skype : callto://pymander
http://www.leisurenouveau.com/
--- End Message ---
--- Begin Message ---
On Tue, Mon Sep 27 06:48:43 2010, Ford, Mike wrote:
> > -----Original Message-----
> > From: tedd [mailto:[email protected]]
> > Sent: 25 September 2010 16:02
>
>
> > One can make the argument that the ELSE IF statement first surfaced
> > circa 1977 in FORTRAN 77 and the CASE statement came later in
> > FORTRAN
> > 90 circa 1991.
>
> Being a fully-fledged member of the pedants' society, I can't let that
> go without comment.
>
> Those dates only hold if you stick to FORTRAN. Algol-68 had
> if-elif-else-fi, and I don't believe it was a pioneer in the structure
> even then (although the syntax may have been novel). It also had a
> case-esac structure. I'd say both elseif and case/switch developed in
> other languages and were adopted into FORTRAN long after they were
> established as bona fide programming constructs.
In Algol 68 rev0 had the longer "conditional clause":
* IF ~ THEN ~ ELSF ~ THEN ~ ELSE ~ FI
Subsequently - in rev1- this was dropped in favour of:
* IF ~ THEN ~ ELIF ~ THEN ~ ELSE ~ FI
Or...
"brief" form:
( condition1 | statements |: condition2 | statements | statements )
Pdf - AB36.3.1 FINAL REPORT ON IMPROVEMENTS TO ALGOL 68
c.f. http://portal.acm.org/citation.cfm?id=1061641 (registration required)
> C 55 (representations)
> Some further small changes:
> elif is now used in place of elsf , (on a bad lineprinter , ELSE was too
> difficult to distinguish from ELSE)
The ALGOL 68 page on wikipedia details the ALGOL 68 conditional clause
in German:
> # Nachfolgetag - Deutsche Variante #
> menge datum = tupel(ganz tag, wort monat, ganz Jahr);
> funktion naechster tag nach = (datum x) datum:
> wenn tag von x < monatslaenge(monat von x, jahr von x)
> dann (tag von x + 1, monat von x, jahr von x)
> wennaber monat von x = "Dezember"
> dann (1, "Januar", jahr von x + 1)
> ansonsten (1, nachfolgemonat(monat von x), jahr von x)
> endewenn;
Note their standard in particular used WENN ... ENDWENN
* WENN ~ DANN ~ WEBBABER ~ DANN ~ ANSONSTEN ~ ENDEWENN
(However I cannot find anther reference to substantiate this, does
anyone have a copy of the German standard?)
The Soviets standardised using Cyrillic, c.f.
"GOST 27974-88 Programming language ALGOL 68 - Язык программирования АЛГОЛ 68"
* http://vak.ru/lib/exe/fetch.php/book/gost/pdf/gost-27974-88.pdf
> Russian/Soviet example: In English Algol68's reverent case statement
> reads case ~ in ~ out ~ esac, in Cyrillic this reads выб ~ в ~ либо ~
> быв.
[OT]: Algol68's standard permitted localisation of the character sets.
The "Final Report" was also available in Braille. (Maybe as Algol68 was
funded by UNESCO). Algol68 allowed reserved words, variable names and
operators in any character set, hence makes Algol68 one of first of the
International programming languages. [Maybe it can even be
Universalised [u11n] because with the advent on Unicode maybe Algol68
cade can written in Romulan? --) ]
NevilleDNZ
--
* http://sourceforge.net/projects/algol68
--- End Message ---