In Python, I can do something like this:
a,b,c = 1,2,3
How might I do this with PHP?
Thanks,
Bart 4 1620
Bart Nessux wrote: In Python, I can do something like this:
a,b,c = 1,2,3
How might I do this with PHP?
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
Bruno Desthuilliers wrote: Bart Nessux wrote:
In Python, I can do something like this:
a,b,c = 1,2,3
How might I do this with PHP? 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
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:
$12 = xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx;
into this line:
$12 = xxxxxxxxxxxxxx
xxxxxxxxxxxxxx
xxxxxxxxxxxxxx;
Thanks,
Bart
Bart Nessux wrote: Bruno Desthuilliers wrote:
Bart Nessux wrote:
In Python, I can do something like this:
a,b,c = 1,2,3
How might I do this with PHP? 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
Thanks for the tip... guess I'll stick to doing on var at a time.
Yeps, I think that's a better choice here. Still, the list() function
may come in handy sometimes...
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 = xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx;
into this line:
$12 = xxxxxxxxxxxxxx xxxxxxxxxxxxxx xxxxxxxxxxxxxx;
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
"Bruno Desthuilliers" <bd*****************@free.quelquepart.fr> wrote in
message news:40*********************@news.free.fr...
<snip> 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 = xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx;
into this line:
$12 = xxxxxxxxxxxxxx xxxxxxxxxxxxxx xxxxxxxxxxxxxx; 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
In the case that it IS a string, you could do this (using the .
concatenation operator):
$a = "xxxxxxxxxxxxxx".
"xxxxxxxxxxxxxx".
"xxxxxxxxxxxxxx";
Garp This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Dan Finn |
last post by:
OpenBSD 3.2
Apache 1.3.26
PHP 4.3.4
PHP-Nuke 6.9
getting these in the apache error log:
Sun Nov 16 20:20:16 2003] PHP Notice: Undefined variable:
HTTP_USER_AGENT in...
|
by: Alexander Zatvornitskiy |
last post by:
Hello All!
I'am novice in python, and I find one very bad thing (from my point of view) in
language. There is no keyword or syntax to declare variable, like 'var' in
Pascal, or special syntax in...
|
by: D Barry |
last post by:
Greetings:
I am trying to conceive what risks might be created by running
multiple SQL servers within a domain under a single domain account, as
opposed to 1) running under the local service...
|
by: Bryan Parkoff |
last post by:
.....I try to reduce un-necessary temporal variables so it can be
optimized for best performance. I try to assign only one register
storage so two variables can access to only one register storage...
|
by: William Wisnieski |
last post by:
Hello Everyone,
I have a main form with a datasheet subform that I use to query by form.
After the user selects two criteria on the main form and clicks the
cmdShowResults button on the main...
|
by: gokkog |
last post by:
Hi there,
There's a classic hash function to hash strings, where MULT is defined
as "31":
//from programming pearls
unsigned int hash(char *ptr)
{ unsigned int h = 0;
unsigned char *p =...
|
by: David W |
last post by:
I am looking for a gridview example for including a multi-select box -
either for in-line editing or master-detail records.
For example, I have 3 tables:
Product, Category, and ProductCategory...
|
by: GaryDean |
last post by:
I have serveral applications now running that are using the
MembershipProvider classes and they are each using their own security tables
in SQL Server 2005 instead of the express databases - they...
|
by: Cameron Simpson |
last post by:
On 17Aug2008 21:25, John Nagle <nagle@animats.comwrote:
Because $HOSTNAME is a bash specific variable, set by bash but NOT
EXPORTED! Like $0 and a bunch of other "private" variables, subprocesses...
|
by: lllomh |
last post by:
Define the method first
this.state = {
buttonBackgroundColor: 'green',
isBlinking: false, // A new status is added to identify whether the button is blinking or not
}
autoStart=()=>{
|
by: DJRhino |
last post by:
Was curious if anyone else was having this same issue or not....
I was just Up/Down graded to windows 11 and now my access combo boxes are not acting right. With win 10 I could start typing...
|
by: Aliciasmith |
last post by:
In an age dominated by smartphones, having a mobile app for your business is no longer an option; it's a necessity. Whether you're a startup or an established enterprise, finding the right mobile app...
|
by: tracyyun |
last post by:
Hello everyone,
I have a question and would like some advice on network connectivity. I have one computer connected to my router via WiFi, but I have two other computers that I want to be able to...
|
by: giovanniandrean |
last post by:
The energy model is structured as follows and uses excel sheets to give input data:
1-Utility.py contains all the functions needed to calculate the variables and other minor things (mentions...
|
by: NeoPa |
last post by:
Hello everyone.
I find myself stuck trying to find the VBA way to get Access to create a PDF of the currently-selected (and open) object (Form or Report).
I know it can be done by selecting :...
|
by: nia12 |
last post by:
Hi there,
I am very new to Access so apologies if any of this is obvious/not clear.
I am creating a data collection tool for health care employees to complete. It consists of a number of...
|
by: NeoPa |
last post by:
Introduction
For this article I'll be focusing on the Report (clsReport) class. This simply handles making the calling Form invisible until all of the Reports opened by it have been closed, when it...
|
by: GKJR |
last post by:
Does anyone have a recommendation to build a standalone application to replace an Access database? I have my bookkeeping software I developed in Access that I would like to make available to other...
| |