Hi.
--on 2003-01-21 09:50 +0100 Armand A. Verstappen wrote: > > > &(var->attr); and &(var[index]); > > > > &(var.attr); still works too, and is also the preferred format at least > > for Midgard 1.4.4. I'm not sure if the arrow-Syntax even works to be > > honest. > > > > I don't agree on the phrase 'preferred format'. As far as I recall the > new syntax was introduced to ease the job of the preparser. Even if the > preparser isn't in common use right now, the newer syntax is faster. > > In my opinion we should start advertising the new syntax as the prefered > one, even if we support the old syntax forever. > > As to what works an what not: > > $array['one'] = "test" > $array['one']['two'] = "test" > $object->one = "test" > $object->one->two = "test" > $array['object']->one = "test" > $object->array['one'] = "test" > > working: > > &(array.one); &(array[one]); &(object.one); &(object->one); The array.one Syntax is deprecated as of 1.4.3, as it makes huge problems with string-indexed names. The correct syntax would be &(array['one']);, the other should trigger a PHP warning at least in E_ALL, as PHP automagically treats the constant "one" as a string (which I find very silly and error-prone). It is quite possible that the . syntax for object dereferencing will also be deprecated in 1.5.0, to get the mechanism fully syntax compatible with PHP. > not working: > > &(array.one.two); &(array[one][two]); &(object.one.two); > &(object->one->two); &(array.object.one); &(array[object]->one); > &(object.array.one); &(object->array[one]); > > So, the newer syntax supports the same scope of variables the old syntax > does. That is right. The primary goal was getting String-Indexed arrays readily available in the preparser, which wasn't fully possible with the old dot-syntax. > I personally think it is a shame that neither syntax supports > multi-dimensional variables, but that is a different issue. That is a known bug, though until yet I have only a vague idea how to solve this. Torben Nehmer --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
