Ask a Question related to PHP Development, Design and Development.
-
lawrence #1
PHP 5.0 passes objects by reference automatically?
Do I understand correctly that in PHP 5.0 objects will be passed by
reference (by handle, they say) automatically, not as a copy, as
happens with most PHP variables?
lawrence Guest
-
I need reference for the objects and methods
I need reference for the objects and methods that comm server support. can smb. help? I have good skills in ActionScript but I'm new to the comm.... -
Web reference/Proxy class problems with custom objects
I have built a webservice which consumes and returns a custom object/class which was generated using XSD.exe from an XML schema. When WSDL.exe... -
[PHP] Passing objects as a reference and extracting the indexof an associative array.
Webmaster wrote: There is no "assignVars" method within Smarty. Are you using something else overtop of it? You can assign the whole array... -
Help: cross-reference overflow between 2 different images/objects
Hello! I got a question this time. It should be a question in general. I´m lookin for a method that might be inside a plugin or filter. It would... -
parsing log in multiple passes
I have output from a CLI that I am parsing into a data structure (hash) to be used as input to another program which reads the hash. The CLI always... -
Manuel Lemos #2
Re: PHP 5.0 passes objects by reference automatically?
Hello,
On 07/03/2003 07:33 PM, Toni Schornboeck wrote:It is not a real performance improvement. You could always do that in> lawrence wrote:
>>>> Do I understand correctly that in PHP 5.0 objects will be passed by
>> reference (by handle, they say) automatically, not as a copy, as
>> happens with most PHP variables?
>
> That's right.
> It will be like in Java - variables are just references (or like Zend
> call them: handles) to objects.
> This will be a big performance improvement!
PHP 4, except that you needed to use the & operator to avoid copying
like this:
$my_object = &new my_class;
--
Regards,
Manuel Lemos
Free ready to use OOP components written in PHP
[url]http://www.phpclasses.org/[/url]
Manuel Lemos Guest
-
Zeek #3
Re: PHP 5.0 passes objects by reference automatically?
"Toni Schornboeck" <toni@schornboek.net> wrote in message
news:3f04afef$0$21620$91cee783@newsreader01.highwa y.telekom.at...[snip snip]> lawrence wrote:5 ... (apache2+php5b1)> is it like java where it would print 5? or does PHP5 is smarter and
> prints 7?
Zeek Guest
-
Wes Bailey #4
Re: PHP 5.0 passes objects by reference automatically?
Unless I am missing something in this code snippet, there isn't any
language that would ever print back 7 since the method Foo is never
invoked. This isn't a property of the language, instead its the
behaviour of you code.
Wes Bailey
>Toni Schornboeck <toni@schornboek.net> wrote in message
> news:<3f04afef$0$21620$91cee783@newsreader01.highw ay.telekom.at>...
> lawrence wrote:>> > Do I understand correctly that in PHP 5.0 objects will be passed by
> > reference (by handle, they say) automatically, not as a copy, as
> > happens with most PHP variables?
> That's right.
> It will be like in Java - variables are just references (or like Zend
> call them: handles) to objects.
> This will be a big performance improvement!
>
> I haven't had time to test PHP5, so could someone test this code:
>
>
> class Test
> {
> public $i;
> function __construct($i)
> {
> $this->i=$i;
> }
> }
>
> function foo($obj)
> {
> $obj=new Test(7);
> }
>
> $obj=new Test(5);
> echo $obj->i;
>
> is it like java where it would print 5? or does PHP5 is smarter and
> prints 7?Wes Bailey Guest



Reply With Quote

