Bart Nessux wrote:[color=blue]
> In Python, I can do something like this:
>
> a,b,c = 1,2,3
>
> How might I do this with PHP?
>[/color]
Have a look at list()
Bruno Desthuilliers wrote:[color=blue]
> Bart Nessux wrote:
>[color=green]
>> In Python, I can do something like this:
>>
>> a,b,c = 1,2,3
>>
>> How might I do this with PHP?
>>[/color]
> Have a look at list()
> http://www.php.net/manual/en/function.list.php
>
> list($a, $b, $c) = Array(1, 2, 3);
>
> should do it. But it's not as readable as Python... !-)
>
> Bruno
>[/color]
Thanks for the tip... guess I'll stick to doing on var at a time. One
last question: How can I split long lines of PHP code up into smaller
lines? For example, how can I turn this line:
Bart Nessux wrote:[color=blue]
> Bruno Desthuilliers wrote:
>[color=green]
>> Bart Nessux wrote:
>>[color=darkred]
>>> In Python, I can do something like this:
>>>
>>> a,b,c = 1,2,3
>>>
>>> How might I do this with PHP?
>>>[/color]
>> Have a look at list()
>> http://www.php.net/manual/en/function.list.php
>>
>> list($a, $b, $c) = Array(1, 2, 3);
>>
>> should do it. But it's not as readable as Python... !-)
>>
>> Bruno
>>[/color]
>
> Thanks for the tip... guess I'll stick to doing on var at a time.[/color]
Yeps, I think that's a better choice here. Still, the list() function
may come in handy sometimes...
[color=blue]
> One
> last question: How can I split long lines of PHP code up into smaller
> lines? For example, how can I turn this line:
>
> $12 = xxxxxxxxxxxxxxx xxxxxxxxxxxxxxx xxxxxxxxxxxxxx;
>
> into this line:
>
> $12 = xxxxxxxxxxxxxx
> xxxxxxxxxxxxxx
> xxxxxxxxxxxxxx;
>[/color]
Assuming the xxxx is php code (not a string), you don't have anything
special to do. Like C and most maintstream languages, PHP uses ';' as
the instruction delimiter. So newlines, whitespaces etc have no special
meaning.
"Bruno Desthuilliers" <bdesth.quelque chose@free.quel quepart.fr> wrote in
message news:405e0f64$0 $291$636a15ce@n ews.free.fr...
<snip>[color=blue][color=green]
> > One
> > last question: How can I split long lines of PHP code up into smaller
> > lines? For example, how can I turn this line:
> >
> > $12 = xxxxxxxxxxxxxxx xxxxxxxxxxxxxxx xxxxxxxxxxxxxx;
> >
> > into this line:
> >
> > $12 = xxxxxxxxxxxxxx
> > xxxxxxxxxxxxxx
> > xxxxxxxxxxxxxx;
> >[/color]
> Assuming the xxxx is php code (not a string), you don't have anything
> special to do. Like C and most maintstream languages, PHP uses ';' as
> the instruction delimiter. So newlines, whitespaces etc have no special
> meaning.
>
> HTH
> Bruno[/color]
In the case that it IS a string, you could do this (using the .
concatenation operator):
$a = "xxxxxxxxxxxxxx ".
"xxxxxxxxxxxxxx ".
"xxxxxxxxxxxxxx ";
Comment