On Fri, Nov 10, 2006 at 05:05:05AM -0700, Rick Widmer wrote: > > > Stanislav Malyshev wrote: > >I'd say expression(f()[1]) means $tmp = f(); expression($tmp); > >unset($tmp); which here means: > >$tmp = foo(); > >$tmp[1] = 4; > >unset($tmp); > > > >which is meaningless but should work. IIRC the engine can make free's at > >the end of expression, so it shouldn't be big problem. Actually, any > >assignment to it if it's not returned by-ref is meaningless, but > >syntactically ok. > > > foo() = 4; results in: > > Fatal error: Can't use function return value in write context in test on > line 12. > > foo()[1] = 4; should do the same.
No, what if they return a reference to something ? In the first case a simple variable, in the second case an array. It those cases assigning to what foo() returns would be reasonable. If foo were to return a constant or a value (not a reference) then the above should be errors. Since functions don't have fixed return types the error test needs to be done at run time. -- Alain Williams Parliament Hill Computers Ltd. Linux Consultant - Mail systems, Web sites, Networking, Programmer, IT Lecturer. +44 (0) 787 668 0256 http://www.phcomp.co.uk/ #include <std_disclaimer.h> -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php