Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.php > #3086 > unrolled thread

what does mean this?

Started byrataplanbumbum <rataplanbumbum>
First post2011-09-06 22:37 +0200
Last post2011-09-07 10:37 -0400
Articles 5 — 4 participants

Back to article view | Back to comp.lang.php


Contents

  what does mean this? rataplanbumbum <rataplanbumbum> - 2011-09-06 22:37 +0200
    Re: what does mean this? Jerry Stuckle <jstucklex@attglobal.net> - 2011-09-06 16:54 -0400
    Re: what does mean this? Michael Fesser <netizen@gmx.de> - 2011-09-06 22:59 +0200
      Re: what does mean this? rataplanbumbum <rataplanbumbum> - 2011-09-07 14:07 +0200
        Re: what does mean this? sheldonlg <sheldonlg@thevillages.net> - 2011-09-07 10:37 -0400

#3086 — what does mean this?

Fromrataplanbumbum <rataplanbumbum>
Date2011-09-06 22:37 +0200
Subjectwhat does mean this?
Message-ID<4e668493$0$15662$4fafbaef@reader2.news.tin.it>
In a script I have a statement:

$cartID = $cart->cartID = $cart->generate_cart_id();


can someone explain what does this mean?

Thanks!

[toc] | [next] | [standalone]


#3087

FromJerry Stuckle <jstucklex@attglobal.net>
Date2011-09-06 16:54 -0400
Message-ID<j461a0$nam$1@dont-email.me>
In reply to#3086
On 9/6/2011 4:37 PM, rataplanbumbum wrote:
> In a script I have a statement:
>
> $cartID = $cart->cartID = $cart->generate_cart_id();
>
>
> can someone explain what does this mean?
>
> Thanks!

It calls the function generate_cart_id() in the object $cart.

It takes the results of that function and places it in the cardID member 
of the object $cart.

It then takes the result and places it in the variable $cartID.

It is equivalent to:

$cart->cartID = $cart->generate_cart_id();
$cartID = $cart->cartID;
-- 
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@attglobal.net
==================

[toc] | [prev] | [next] | [standalone]


#3088

FromMichael Fesser <netizen@gmx.de>
Date2011-09-06 22:59 +0200
Message-ID<up1d67t0973bdmlmne3fml018fararr39k@mfesser.de>
In reply to#3086
.oO(rataplanbumbum)

>In a script I have a statement:
>
>$cartID = $cart->cartID = $cart->generate_cart_id();
>
>
>can someone explain what does this mean?

$cart is an object. Its method generate_cart_id() returns some value,
which is assigned to both the variable $cartID and the object property
$cart->cartID.

A more complex way to code this would be:

$result = $cart->generate_cart_id();
$cart->cartID = $result;
$cartID = $result;

What's ugly about this is that the same value is stored in an object
property and in a variable. Without knowing the context this doesn't
look good.

Micha

-- 
http://mfesser.de/blickwinkel

[toc] | [prev] | [next] | [standalone]


#3093

Fromrataplanbumbum <rataplanbumbum>
Date2011-09-07 14:07 +0200
Message-ID<4e675e6d$0$15658$4fafbaef@reader2.news.tin.it>
In reply to#3088
Il 06/09/2011 22:59, Michael Fesser ha scritto:
> .oO(rataplanbumbum)
>
>> In a script I have a statement:
>>
>> $cartID = $cart->cartID = $cart->generate_cart_id();
>>
>>
>> can someone explain what does this mean?
>
> $cart is an object. Its method generate_cart_id() returns some value,
> which is assigned to both the variable $cartID and the object property
> $cart->cartID.
>
> A more complex way to code this would be:
>
> $result = $cart->generate_cart_id();
> $cart->cartID = $result;
> $cartID = $result;
>
> What's ugly about this is that the same value is stored in an object
> property and in a variable. Without knowing the context this doesn't
> look good.
>
> Micha
>

tnks

[toc] | [prev] | [next] | [standalone]


#3094

Fromsheldonlg <sheldonlg@thevillages.net>
Date2011-09-07 10:37 -0400
Message-ID<j4803l$k10$1@dont-email.me>
In reply to#3093
On 9/7/2011 8:07 AM, rataplanbumbum wrote:
> Il 06/09/2011 22:59, Michael Fesser ha scritto:
>> .oO(rataplanbumbum)
>>
>>> In a script I have a statement:
>>>
>>> $cartID = $cart->cartID = $cart->generate_cart_id();
>>>
>>>
>>> can someone explain what does this mean?
>>
>> $cart is an object. Its method generate_cart_id() returns some value,
>> which is assigned to both the variable $cartID and the object property
>> $cart->cartID.
>>
>> A more complex way to code this would be:
>>
>> $result = $cart->generate_cart_id();
>> $cart->cartID = $result;
>> $cartID = $result;
>>
>> What's ugly about this is that the same value is stored in an object
>> property and in a variable. Without knowing the context this doesn't
>> look good.
>>
>> Micha
>>
>
> tnks

I would write this code as:

$cart->generate_cart_id();
$cartID = $cart->getCartId();

(where generate_cart_id() would also store a private class variable, 
$cardID, as part of the generation)


-- 
Shelly

[toc] | [prev] | [standalone]


Back to top | Article view | comp.lang.php


csiph-web