[PHP] variable

2009-09-24 Thread Grega Leskovšek
Suppose I have a variable $i = 0 or 1 or 2 and I have variables $item0, $item1 and $item2 how do I print the variable $item0 using a combination of variable $item and variable $i? or with this code it gives me an error: $i = 0; $item0 = test; echo $item$i; #how do I properly use this variable

Re: [PHP] variable

2009-09-24 Thread Tommy Pham
- Original Message From: Grega Leskovšek legr...@gmail.com To: php-general@lists.php.net Sent: Thursday, September 24, 2009 10:10:33 AM Subject: [PHP] variable Suppose I have a variable $i = 0 or 1 or 2 and I have variables $item0, $item1 and $item2 how do I print the variable

Re: [PHP] variable

2009-09-24 Thread Tommy Pham
- Original Message From: Tommy Pham tommy...@yahoo.com To: Grega Leskovšek legr...@gmail.com; php-general@lists.php.net Sent: Thursday, September 24, 2009 10:16:44 AM Subject: Re: [PHP] variable - Original Message From: Grega Leskovšek To: php-general

Re: [PHP] variable

2009-09-24 Thread Ben Dunlap
Suppose I have a variable $i = 0 or 1 or 2 and I have variables $item0, $item1 and $item2 how do I print the variable $item0 using a combination of variable $item and variable $i? or with this code it gives me an error: $i = 0; $item0 = test; echo $item$i; #how do I properly use this

Re: [PHP] variable

2009-09-24 Thread Lars Nielsen
Hi Grega I think you might want to have a look at the array's section of the php manual. http://www.php.net/array regards Lars tor, 24 09 2009 kl. 19:10 +0200, skrev Grega Leskovšek: Suppose I have a variable $i = 0 or 1 or 2 and I have variables $item0, $item1 and $item2 how do I print the

Re: [PHP] how i assign a js variable to a php variable

2009-09-19 Thread tedd
At 2:16 AM +0700 9/18/09, saeed ahmed wrote: hello guys, i'm new here in this list. guys i need a help. i can't assign a js variable value to a php variable. how can i do this? saeed: Considering that js is client-side and php is server-side, you need to pass the value via a communication

Re: [PHP] how i assign a js variable to a php variable

2009-09-18 Thread Gautam Bhatia
. i can't assign a js variable value to a php variable. how can i do this? -- Regards, Saeed Ahmed Rajshahi, Bangladesh Blog: http://saeed05.wordpress.com -- Follow Me Linkedin http://www.linkedin.com/in/sas05Twitterhttp://twitter.com/saeed05 -- PHP General Mailing List (http

Re: [PHP] how i assign a js variable to a php variable

2009-09-18 Thread Jonathan Vivero
with the server side code that is your php :). Regards, Gautam Bhatia Punjab,India mail2gautambha...@gmail.com On Fri, 2009-09-18 at 02:16 +0700, saeed ahmed wrote: hello guys, i'm new here in this list. guys i need a help. i can't assign a js variable value to a php variable. how can i

RE: [PHP] how i assign a js variable to a php variable

2009-09-18 Thread Andrea Giammarchi
basicly is use hidden inputs as a container for php variables, and transform through js. really? I though the other way round was extremely simple: echo 'script type=text/javascriptvar myPHPvar=eval(('.addslashes(json_encode($myPHPvar)).'));/script'; why would you use hidden input, plus

RE: [PHP] how i assign a js variable to a php variable

2009-09-18 Thread Andrea Giammarchi
@lists.php.net Date: Fri, 18 Sep 2009 13:01:28 +0200 Subject: RE: [PHP] how i assign a js variable to a php variable basicly is use hidden inputs as a container for php variables, and transform through js. really? I though the other way round was extremely simple: echo 'script type=text

Re: [PHP] how i assign a js variable to a php variable

2009-09-18 Thread Jonathan Vivero
i assign a js variable to a php variable basicly is use hidden inputs as a container for php variables, and transform through js. really? I though the other way round was extremely simple: echo 'script type=text/javascriptvar myPHPvar=eval(('.addslashes(json_encode($myPHPvar

Re: [PHP] how i assign a js variable to a php variable

2009-09-18 Thread Jonathan Vivero
-general@lists.php.net Date: Fri, 18 Sep 2009 13:01:28 +0200 Subject: RE: [PHP] how i assign a js variable to a php variable basicly is use hidden inputs as a container for php variables, and transform through js. really? I though the other way round was extremely simple: echo

RE: [PHP] how i assign a js variable to a php variable

2009-09-18 Thread Andrea Giammarchi
You can not pass this myPHPvar javascript var as an input in a form. if you want to change its value and maintein it, must to use an static var, and only can access to this values via javascript functions where an event is invoked (in case you want to read or write values) with all due

[PHP] how i assign a js variable to a php variable

2009-09-17 Thread saeed ahmed
hello guys, i'm new here in this list. guys i need a help. i can't assign a js variable value to a php variable. how can i do this? -- Regards, Saeed Ahmed Rajshahi, Bangladesh Blog: http://saeed05.wordpress.com -- Follow Me Linkedin http://www.linkedin.com/in/sas05Twitterhttp://twitter.com

Re: [PHP] how i assign a js variable to a php variable

2009-09-17 Thread Ashley Sheridan
On Fri, 2009-09-18 at 02:16 +0700, saeed ahmed wrote: hello guys, i'm new here in this list. guys i need a help. i can't assign a js variable value to a php variable. how can i do this? -- Regards, Saeed Ahmed Rajshahi, Bangladesh Blog: http://saeed05.wordpress.com -- Follow Me

RE: [PHP] how i assign a js variable to a php variable

2009-09-17 Thread Andrea Giammarchi
I have to disagree Ash, you can pass js variable values to PHP but only through a page load. Then you could use $_REQUEST, $_POST, $_GET to retrieve it. I have done this before. And I am sure Ash does it on daily basis, the problem is the used therm: I want to *assign* ... not pass, assign!

RE: [PHP] how i assign a js variable to a php variable

2009-09-17 Thread HallMarc Websites
-Original Message- From: Ashley Sheridan [mailto:a...@ashleysheridan.co.uk] Sent: Thursday, September 17, 2009 3:19 PM To: saeed ahmed Cc: php-general@lists.php.net Subject: Re: [PHP] how i assign a js variable to a php variable On Fri, 2009-09-18 at 02:16 +0700, saeed ahmed wrote

Re: [PHP] how i assign a js variable to a php variable

2009-09-17 Thread Phred White
On Sep 17, 2009, at 2:43 PM, Andrea Giammarchi wrote: I have to disagree Ash, you can pass js variable values to PHP but only through a page load. Then you could use $_REQUEST, $_POST, $_GET to retrieve it. I have done this before. And I am sure Ash does it on daily basis, the problem

RE: [PHP] how i assign a js variable to a php variable

2009-09-17 Thread HallMarc Websites
for that. You were absolutely correct in your statement about not being able to directly assign the value of a javascript variable to a PHP variable. I just felt that your response would leave the reader to believe that that wasn't any way to pass the value at all. In my attempt to throw my two cents

[PHP] Variable Scope with require_once

2009-04-27 Thread user
Hello, all. I have a working app that runs in PHP 4.4.9 on the server. I develop the app on my local environment, which runs PHP 5.2.6. The setup is thus: From my index, I have require_once('config.php'); require_once('dbstuff.php'); config.php looks like this: ?php $db_host =

[PHP] Variable formatting problem using sessions...

2009-01-26 Thread Rick Duval
I'm using an OnClick routine to set a session variable before I go to another page. onClick=?php $_SESSION['local_part']= 'rick'; ? works fine but I need a variable where rick is I've tried onClick=?php $_SESSION['local_part']= $local_part; ? and other variations but it doesn't work. Can

Re: [PHP] Variable formatting problem using sessions...

2009-01-26 Thread Chris
Rick Duval wrote: I'm using an OnClick routine to set a session variable before I go to another page. onClick=?php $_SESSION['local_part']= 'rick'; ? works fine but I need a variable where rick is I've tried onClick=?php $_SESSION['local_part']= $local_part; ? and other variations but it

[PHP] variable probe revision

2009-01-12 Thread Frank Stanovcak
I posted this once before, and then tried to use it multiple times in a script. As you can guess I got a bunch of func already defined errors. Here is a revision incase anyone decided to use it that will work multiple times in the same script for variable watching. ---Code follows---

Re: [PHP] variable probe revision

2009-01-12 Thread Ashley Sheridan
On Mon, 2009-01-12 at 16:11 -0500, Frank Stanovcak wrote: I posted this once before, and then tried to use it multiple times in a script. As you can guess I got a bunch of func already defined errors. Here is a revision incase anyone decided to use it that will work multiple times in the

Re: [PHP] variable probe revision

2009-01-12 Thread Frank Stanovcak
Ashley Sheridan a...@ashleysheridan.co.uk wrote in message news:1231796437.3558.62.ca...@localhost.localdomain... On Mon, 2009-01-12 at 16:11 -0500, Frank Stanovcak wrote: I posted this once before, and then tried to use it multiple times in a script. As you can guess I got a bunch of func

Re: [PHP] variable probe revision

2009-01-12 Thread Chris
Frank Stanovcak wrote: I posted this once before, and then tried to use it multiple times in a script. As you can guess I got a bunch of func already defined errors. Here is a revision incase anyone decided to use it that will work multiple times in the same script for variable watching.

Re: [PHP] variable probe revision

2009-01-12 Thread Frank Stanovcak
Chris dmag...@gmail.com wrote in message news:496bbd52.2080...@gmail.com... Frank Stanovcak wrote: I posted this once before, and then tried to use it multiple times in a script. As you can guess I got a bunch of func already defined errors. Here is a revision incase anyone decided to use

[PHP] Re: Assignment (Was Re: [PHP] More microptimisation (Was Re: [PHP] Variable as an index)

2008-12-24 Thread tedd
At 11:06 AM +1100 12/24/08, Clancy wrote: On Tue, 23 Dec 2008 10:25:13 -0500, tedd.sperl...@gmail.com (tedd) wrote: Two things: 1. One statement, one line. 2. The code between the two examples is different; produces different results; and thus is rather pointless in making a definitive

Re: [PHP] More microptimisation (Was Re: [PHP] Variable as an index)

2008-12-23 Thread German Geek
oops, yes of course lol Tim-Hinnerk Heuer http://www.ihostnz.com On Tue, Dec 23, 2008 at 7:43 PM, Lars Torben Wilson larstor...@gmail.comwrote: 2008/12/22 German Geek geek...@gmail.com: agree, ++$i wont save u nething, it just means that the variable is incremented after it is used: You

Re: [PHP] More microptimisation (Was Re: [PHP] Variable as an index)

2008-12-23 Thread Clancy
On Mon, 22 Dec 2008 22:40:58 -0800, larstor...@gmail.com (Lars Torben Wilson) wrote: Well, in all fairness, it *is* faster--but you'll only notice the difference in extremely tight and long-running loops (try it ;) ). As long as you know why you're using it and what the side effects are, it

[PHP] Assignment (Was Re: [PHP] More microptimisation (Was Re: [PHP] Variable as an index)

2008-12-23 Thread tedd
At 9:10 AM +1100 12/23/08, Clancy wrote: Schlossnagle (in Advanced PHP Programming) advises: $i = 0; while ($i $j) { ++$i; } rather than: $i = 0; while ($i $j) { ... $i++; } as the former apparently uses less

[PHP] Re: Assignment (Was Re: [PHP] More microptimisation (Was Re: [PHP] Variable as an index)

2008-12-23 Thread Clancy
On Tue, 23 Dec 2008 10:25:13 -0500, tedd.sperl...@gmail.com (tedd) wrote: At 9:10 AM +1100 12/23/08, Clancy wrote: Schlossnagle (in Advanced PHP Programming) advises: $i = 0; while ($i $j) { ++$i; } rather than: $i = 0; while ($i $j) { ...

Re: [PHP] Variable as an index

2008-12-22 Thread Jochem Maas
MikeP schreef: Hello, I am trying to output the value of the following:($x is an int incremented by a for statement. echo tr td width='110' bgcolor='$row_color' nowrap '$users[$x][U]'/td /tr; I have tried putting the quotes all over and all I get is: 'Array[U]'. What

[PHP] More microptimisation (Was Re: [PHP] Variable as an index)

2008-12-22 Thread Clancy
On Mon, 22 Dec 2008 10:20:09 +1100, dmag...@gmail.com (Chris) wrote: I'd call this a micro-optimization. If changing this causes that much of a difference in your script, wow - you're way ahead of the rest of us. Schlossnagle (in Advanced PHP Programming) advises: $i = 0; while ($i

Re: [PHP] More microptimisation (Was Re: [PHP] Variable as an index)

2008-12-22 Thread Nathan Nobbe
On Mon, Dec 22, 2008 at 3:10 PM, Clancy clanc...@cybec.com.au wrote: On Mon, 22 Dec 2008 10:20:09 +1100, dmag...@gmail.com (Chris) wrote: I'd call this a micro-optimization. If changing this causes that much of a difference in your script, wow - you're way ahead of the rest of

Re: [PHP] More microptimisation (Was Re: [PHP] Variable as an index)

2008-12-22 Thread German Geek
agree, ++$i wont save u nething, it just means that the variable is incremented after it is used: $i = 0; while ($i 4) echo $i++; will output 0123 while $i = 0; while ($i 4) echo ++$i; will output 1234 Tim-Hinnerk Heuer http://www.ihostnz.com On Tue, Dec 23, 2008 at 7:25 PM, Nathan

Re: [PHP] More microptimisation (Was Re: [PHP] Variable as an index)

2008-12-22 Thread Lars Torben Wilson
2008/12/22 Nathan Nobbe quickshif...@gmail.com: On Mon, Dec 22, 2008 at 3:10 PM, Clancy clanc...@cybec.com.au wrote: On Mon, 22 Dec 2008 10:20:09 +1100, dmag...@gmail.com (Chris) wrote: I'd call this a micro-optimization. If changing this causes that much of a difference in your

Re: [PHP] More microptimisation (Was Re: [PHP] Variable as an index)

2008-12-22 Thread Lars Torben Wilson
2008/12/22 German Geek geek...@gmail.com: agree, ++$i wont save u nething, it just means that the variable is incremented after it is used: You meant . . .before it is used:, right? Torben $i = 0; while ($i 4) echo $i++; will output 0123 while $i = 0; while ($i 4) echo ++$i;

Re: [PHP] More microptimisation (Was Re: [PHP] Variable as an index)

2008-12-22 Thread Nathan Nobbe
On Mon, Dec 22, 2008 at 11:43 PM, Lars Torben Wilson larstor...@gmail.comwrote: 2008/12/22 German Geek geek...@gmail.com: agree, ++$i wont save u nething, it just means that the variable is incremented after it is used: You meant . . .before it is used:, right? i hope so, coming from an

[PHP] Variable as an index

2008-12-21 Thread MikeP
Hello, I am trying to output the value of the following:($x is an int incremented by a for statement. echo tr td width='110' bgcolor='$row_color' nowrap '$users[$x][U]'/td /tr; I have tried putting the quotes all over and all I get is: 'Array[U]'. What am I doing wrong. Thanks

Re: [PHP] Variable as an index

2008-12-21 Thread Marc Steinert
MikeP schrieb: I have tried putting the quotes all over and all I get is: 'Array[U]'. Try to avoid accessing the two-dimensional array $users inside a string. Use echo's ability to accept multiple parameters: echo 'trtd.', $users[$x]['U'], '/td'; Or by concating the string with

Re: [PHP] Variable as an index

2008-12-21 Thread German Geek
$users is an array and you are trying to simply put it in a string. $x seems to be undefined ergo it's not printing anything. If 'U' is the index in the array for your variable, use the '.' operator to concatenate strings: echo tr td width='110' bgcolor='$row_color' nowrap ' .

Re: [PHP] Variable as an index

2008-12-21 Thread German Geek
OK. I would think it uses more memory then, but doubt it would be slower. Isnt the output buffered in memory anyway though in PHP? Surely the buffer is bigger than 100 bytes (which is about the length of this string). So one way or the other, the memory is used. Tim-Hinnerk Heuer

Re: [PHP] Variable as an index

2008-12-21 Thread German Geek
Why is the first method faster and uses less memory? Tim-Hinnerk Heuer http://www.ihostnz.com On Mon, Dec 22, 2008 at 10:59 AM, Marc Steinert li...@bithub.net wrote: MikeP schrieb: I have tried putting the quotes all over and all I get is: 'Array[U]'. Try to avoid accessing the

Re: [PHP] Variable as an index

2008-12-21 Thread Marc Steinert
German Geek schrieb: Why is the first method faster and uses less memory? Because the concatenation operator first reassembles a new string, stores it in memory then passes this newly created string to the echo function, if I'm not misstaken. -- http://bithub.net/ Synchronize and share

Re: [PHP] Variable as an index

2008-12-21 Thread Anthony Gentile
for e.g. $var = 'world'; echo hello $var; vs echo 'hello '.$var; The first uses twice as many opcodes as compared to the second. The first is init a string and adding to it the first part(string) and then the second part (var); once completed it can echo it out. The second is simply two opcodes,

Re: [PHP] Variable as an index

2008-12-21 Thread Anthony Gentile
True, it might mean the very slightest in milliseconds...depending on what you're doing/hardware. However, no harm in understanding the difference/how it works. Many will code echo Hello World and echo 'Hello World'; and never know the difference, I just happen to think being aware of the details

Re: [PHP] Variable as an index

2008-12-21 Thread Chris
Anthony Gentile wrote: True, it might mean the very slightest in milliseconds...depending on what you're doing/hardware. Connecting to a db will (probably) take longer than most of those differences, let alone running a query processing the results. Ternaries that make a lot of people feel

Re: [PHP] Variable as an index

2008-12-21 Thread Chris
Anthony Gentile wrote: for e.g. $var = 'world'; echo hello $var; vs echo 'hello '.$var; The first uses twice as many opcodes as compared to the second. The first is init a string and adding to it the first part(string) and then the second part (var); once completed it can echo it out. The

Re: [PHP] Variable as an index

2008-12-21 Thread German Geek
Yes, i agree with this. Even if it takes a few nano seconds more to write out more understandable code, it's worth doing it because code management is more important than sqeezing out the last nano second. And then also an $var = Hello; echo $val World; has less characters than and is more

Re: [PHP] Variable as an index

2008-12-21 Thread Lars Torben Wilson
2008/12/21 German Geek geek...@gmail.com: Yes, i agree with this. Even if it takes a few nano seconds more to write out more understandable code, it's worth doing it because code management is more important than sqeezing out the last nano second. And then also an $var = Hello; echo $val

[PHP] Variable Scope problem passing function parameters

2008-12-18 Thread Jim McIntyre
I'm new to PHP 5 and classes, but I've done a lot of ActionScript. I'm trying to use PHPMailer inside my own class (a service for AMFPHP). I'm having problems getting the data that'spassed into my class's send() method to the instance of the PHPMailer. Basically, I have this: class EmailAMF

Re: [PHP] Variable Scope problem passing function parameters

2008-12-18 Thread metastable
Jim McIntyre wrote: I'm new to PHP 5 and classes, but I've done a lot of ActionScript. I'm trying to use PHPMailer inside my own class (a service for AMFPHP). I'm having problems getting the data that'spassed into my class's send() method to the instance of the PHPMailer. Basically, I have

Re: [PHP] Variable Scope problem passing function parameters

2008-12-18 Thread Jim McIntyre
metastable wrote: Jim McIntyre wrote: $phpMail = new PHPMailer(); $phpMail-From = $from; $phpMail-AddAddress($this-to); $phpMail-Subject = $subject; $phpMail-Body = $body; return $phpMail-Send(); $this - to it has no meaning in the scope of your class. Apparently,

[PHP] SOLVED Re: [PHP] Variable Scope problem passing function parameters

2008-12-18 Thread Jim McIntyre
Jim McIntyre wrote: metastable wrote: Jim McIntyre wrote: $phpMail = new PHPMailer(); $phpMail-From = $from; $phpMail-AddAddress($this-to); $phpMail-Subject = $subject; $phpMail-Body = $body; return $phpMail-Send(); Never mind - I found the problem. It was a lowly

[PHP] Variable name for constants?

2008-12-11 Thread Anders Norrbring
I've been experimenting with having a varaible constant name, but failed miserably... Can I please have a pointer? What I'm trying to do is something like this: $name = home; Then read the constant IMG_HOME, like IMG_$name, I'm not sure I make myself understood, but I hope so.. Anders. --

Re: [PHP] Variable name for constants?

2008-12-11 Thread clive
Anders Norrbring wrote: I've been experimenting with having a varaible constant name, but failed miserably... Can I please have a pointer? What I'm trying to do is something like this: $name = home; Then read the constant IMG_HOME, like IMG_$name, I'm not sure I make myself understood, but I

Re: [PHP] Variable name for constants?

2008-12-11 Thread clive
I dont think you can do that with a constant, but you can do this a normal variable: I stand under correction form my previous email, it can be done: define('TEST', 'the value of constant TEST'); $var= 'TEST'; echo constant($var); -- PHP General Mailing List (http://www.php.net/) To

Re: [PHP] Variable name for constants?

2008-12-11 Thread HostWare Kft.
, 2008 9:18 AM Subject: Re: [PHP] Variable name for constants? I dont think you can do that with a constant, but you can do this a normal variable: I stand under correction form my previous email, it can be done: define('TEST', 'the value of constant TEST'); $var= 'TEST'; echo constant

SV: [PHP] Variable name for constants?

2008-12-11 Thread Anders Norrbring
I dont think you can do that with a constant, but you can do this a normal variable: I stand under correction form my previous email, it can be done: define('TEST', 'the value of constant TEST'); $var= 'TEST'; echo constant($var); This may be too early in the morning for me,

SV: [PHP] Variable name for constants?

2008-12-11 Thread Anders Norrbring
, December 11, 2008 9:18 AM Subject: Re: [PHP] Variable name for constants? I dont think you can do that with a constant, but you can do this a normal variable: I stand under correction form my previous email, it can be done: define('TEST', 'the value of constant TEST'); $var

Re: [PHP] Variable Argument List

2008-11-17 Thread Nathan Rixham
Richard Heyes wrote: ... And you might also be interested in func_get_args(), which returns an array of args passed to the function (don't know what it does if used outside a function. Probably get an error). yup.. bWarning/b: func_get_args(): Called from the global scope - no function

Re: [PHP] Variable Argument List

2008-11-17 Thread Shiplu
On Fri, Nov 14, 2008 at 8:13 PM, Daniel Kolbo [EMAIL PROTECTED] wrote: Hello, I am trying to do something like the following: ?php function hello($var1 = 'default1', $var2 = 'default2') { echo $var1:$var2; } $func= hello; $args = 'yo','bob'; $func($args); ? I understand why this

Re: [PHP] Variable Argument List

2008-11-17 Thread Richard Heyes
yup.. bWarning/b: func_get_args(): Called from the global scope - no function context Doesn't the name of the function give you a clue as to its use? You need to call it inside a function. -- Richard Heyes HTML5 Graphing for FF, Chrome, Opera and Safari: http://www.rgraph.org (Updated

Re: [PHP] Variable Argument List

2008-11-17 Thread Robert Cummings
On Mon, 2008-11-17 at 11:54 -0500, Shiplu wrote: On Fri, Nov 14, 2008 at 8:13 PM, Daniel Kolbo [EMAIL PROTECTED] wrote: Hello, I am trying to do something like the following: ?php function hello($var1 = 'default1', $var2 = 'default2') { echo $var1:$var2; } $func= hello;

Re: [PHP] Variable Argument List

2008-11-17 Thread Craige Leeder
Richard Heyes wrote: yup.. bWarning/b: func_get_args(): Called from the global scope - no function context Doesn't the name of the function give you a clue as to its use? You need to call it inside a function. He was answering Nathan's question regarding what would happen IF you

Re: [PHP] Variable Argument List

2008-11-15 Thread Richard Heyes
... And you might also be interested in func_get_args(), which returns an array of args passed to the function (don't know what it does if used outside a function. Probably get an error). -- Richard Heyes HTML5 Graphing for FF, Chrome, Opera and Safari: http://www.rgraph.org (Updated November

[PHP] Variable Argument List

2008-11-14 Thread Daniel Kolbo
Hello, I am trying to do something like the following: ?php function hello($var1 = 'default1', $var2 = 'default2') { echo $var1:$var2; } $func= hello; $args = 'yo','bob'; $func($args); ? I understand why this outputs: 'yo','bob':default2 However, I want it to output: yo:bob Is this

Re: [PHP] Variable Argument List

2008-11-14 Thread Daniel Kolbo
Daniel Kolbo wrote: Hello, I am trying to do something like the following: ?php function hello($var1 = 'default1', $var2 = 'default2') { echo $var1:$var2; } $func= hello; $args = 'yo','bob'; $func($args); ? I understand why this outputs: 'yo','bob':default2 However, I want it to

Re: [PHP] Variable Variables and Super Global Arrays

2008-10-12 Thread Richard Heyes
$varname = \$_SERVER['REMOTE_ADDR']; $varvalue = $$varname; That's wrong. Offhand you'll end up printing a string. I tried this: ?php $a = 365; $b = 366; $var = $_GET['var']; echo $$var; ? And it was fine. -- Richard Heyes HTML5 Graphing for FF, Chrome, Opera and

Re: [PHP] Variable Variables and Super Global Arrays

2008-10-12 Thread Micah Gersten
That's fine as a test, but you never want to get a variable name from a URL in practice. Thank you, Micah Gersten onShore Networks Internal Developer http://www.onshore.com Richard Heyes wrote: $varname = \$_SERVER['REMOTE_ADDR']; $varvalue = $$varname; That's wrong. Offhand you'll

Re: [PHP] Variable Variables and Super Global Arrays

2008-10-12 Thread Richard Heyes
That's fine as a test, but you never want to get a variable name from a URL in practice. Of course you can, as long as it's sanitized and checked. -- Richard Heyes HTML5 Graphing for FF, Chrome, Opera and Safari: http://www.rgraph.org -- PHP General Mailing List (http://www.php.net/) To

Re: [PHP] Variable Variables and Super Global Arrays

2008-10-12 Thread Micah Gersten
I mean that it is open for hacking if you pass a variable name through a URL. Thank you, Micah Gersten onShore Networks Internal Developer http://www.onshore.com daniel danon wrote: What do you mean? On Sun, Oct 12, 2008 at 5:40 PM, Micah Gersten [EMAIL PROTECTED] mailto:[EMAIL PROTECTED]

[PHP] Variable Variables and Super Global Arrays

2008-10-10 Thread daniel danon
Hi, I was wondering, By php.net manual, Please note that variable variables cannot be used with PHP's Superglobal arrays within functions or class methods. Is there any way to override this problem? Just the not nice eval(return $variable);? and in simple words - is there any way to make the

[PHP] Variable name as a string

2008-08-27 Thread ioannes
Could someone tell me how to get the name of a variable as a string. This would be useful in form submission with multiple check-boxes to match against database records. At the moment I use ${var.$ID[$x]} or someting like that to go through all the possible matches, but it would be quicker

Re: [PHP] Variable name as a string

2008-08-27 Thread Hélio Rocha
U could use an array to keep all of your fieldnames as keys and the values would be the values of the form inputs. That would be very easy and with no programagic. On Wed, Aug 27, 2008 at 3:00 PM, ioannes [EMAIL PROTECTED] wrote: Could someone tell me how to get the name of a variable as a

Re: [PHP] Variable number of parameters

2008-08-05 Thread Daniel Brown
On Tue, Aug 5, 2008 at 1:40 AM, Philip Thompson [EMAIL PROTECTED] wrote: Is it possible to grab a variable number of parameters and send the appropriate amount to another function? You can predefine function parameters: ?php function example($line1,$line2=There is no line 2.) { echo

Re: [PHP] Variable number of parameters

2008-08-05 Thread Philip Thompson
On Aug 5, 2008, at 8:58 AM, Daniel Brown wrote: On Tue, Aug 5, 2008 at 1:40 AM, Philip Thompson [EMAIL PROTECTED] wrote: Is it possible to grab a variable number of parameters and send the appropriate amount to another function? You can predefine function parameters: ?php function

Re: [PHP] Variable number of parameters

2008-08-05 Thread Igor Kolodziejczyk
Philip Thompson wrote: On Aug 5, 2008, at 8:58 AM, Daniel Brown wrote: On Tue, Aug 5, 2008 at 1:40 AM, Philip Thompson [EMAIL PROTECTED] wrote: Is it possible to grab a variable number of parameters and send the appropriate amount to another function? You can predefine function

Re: [PHP] Variable number of parameters

2008-08-05 Thread Per Jessen
Philip Thompson wrote: but more likely, you're looking for func_get_args(). http://php.net/func_get_args Fortunately, I am quite familiar with your example. However, I am more looking for something in which I could send any number of parameters to my own function, grab each

Re: [PHP] Variable number of parameters

2008-08-05 Thread Philip Thompson
On Aug 5, 2008, at 10:34 AM, Igor Kolodziejczyk wrote: Philip Thompson wrote: On Aug 5, 2008, at 8:58 AM, Daniel Brown wrote: On Tue, Aug 5, 2008 at 1:40 AM, Philip Thompson [EMAIL PROTECTED] wrote: Is it possible to grab a variable number of parameters and send the appropriate amount to

Re: [PHP] Variable number of parameters

2008-08-05 Thread Per Jessen
Philip Thompson wrote: This isn't exactly what I'm wanting to achieve. I don't want to send each parameter individually, I want to send them all at the same time. Sounds like you want the standard varargs behaviour from C ? Where you can gather up a list of arguments as a va_list and pass that

Re: [PHP] Variable number of parameters

2008-08-05 Thread Jim Lucas
Philip Thompson wrote: Is it possible to grab a variable number of parameters and send the appropriate amount to another function? ?php // Some class $this-db-prepare(SELECT * FROM `table` WHERE (`id`=?)); $this-db-bind('ii', $id1); $this-db-prepare(SELECT * FROM `table` WHERE (`id`=? AND

Re: [PHP] Variable number of parameters

2008-08-05 Thread Daniel Brown
On Tue, Aug 5, 2008 at 6:07 PM, Jim Lucas [EMAIL PROTECTED] wrote: # WARNING # The following example uses eval() to do the execution. # The following answer is a YMMV answer. # Be careful with it. I could be a sleeping snake waiting to bite... # Errata for those of you

Re: [PHP] Variable number of parameters

2008-08-05 Thread Larry Garfield
On Tuesday 05 August 2008 12:40:27 am Philip Thompson wrote: Ok, is it possible to send any number of variables to db-bind() in order to send those to statement-bind_param()? Or, if someone else has a better db abstraction method, feel free to educate... Thanks, ~Phil Unless I'm

[PHP] Variable number of parameters

2008-08-04 Thread Philip Thompson
Is it possible to grab a variable number of parameters and send the appropriate amount to another function? ?php // Some class $this-db-prepare(SELECT * FROM `table` WHERE (`id`=?)); $this-db-bind('ii', $id1); $this-db-prepare(SELECT * FROM `table` WHERE (`id`=? AND `other_id`=?));

[PHP] Variable not showing up.

2008-07-02 Thread Steve Marquez
Greetings, The following code works in every way except one. The variable, $linkspage, in the link, will not replace with information from the database for some reason. No matter what else I put in $id_num, $filename or whatever it replaces, but not $linkspage. The variable does work

Re: [PHP] Variable not showing up.

2008-07-02 Thread Jim Lucas
Couple things, read in-line... Steve Marquez wrote: Greetings, The following code works in every way except one. The variable, $linkspage, in the link, will not replace with information from the database for some reason. No matter what else I put in $id_num, $filename or whatever it

Re: [PHP] Variable Scope from child to parent

2008-05-15 Thread Andrew Ballard
Ok, I forgot to reply-all to the list. Here we go again. On Wed, May 14, 2008 at 6:33 PM, Tyson Vanover [EMAIL PROTECTED] wrote: I am trying to get a child class to pass an array of valid keys to it's parent when the constructor is run, and the parent appends the data to one of it's array of

[PHP] Variable Scope from child to parent

2008-05-14 Thread Tyson Vanover
I am trying to get a child class to pass an array of valid keys to it's parent when the constructor is run, and the parent appends the data to one of it's array of valid keys. Then it walks through an array pulling out values that have valid keys, and putting them in an array for processing

Re: [PHP] Variable Scope from child to parent

2008-05-14 Thread Gabriel Sosa
tyson i never saw self::$this-vkeys doing this you actually are callig the var inside $this-vkeys do self::$vkeys as static or $this-vkeys as object don't mix regards On Wed, May 14, 2008 at 7:33 PM, Tyson Vanover [EMAIL PROTECTED] wrote: I am trying to get a child class to pass an array

[PHP] Variable varialbe with array not working

2008-04-30 Thread kronostar
I am trying to use variable variables in an array. ?The last line of code does not work. ?More specifically the last variable in the last line of code does not work in this setup. ?The array gets created with the appropriate indexes however the values are blank. ?I can echo item_value and it

Re: [PHP] Variable post as array

2008-03-05 Thread Daniel Brown
On Wed, Mar 5, 2008 at 4:58 AM, Pieter du Toit [EMAIL PROTECTED] wrote: And unless you have your (Apache|IIS|etc.) web server set to disable direct-access and/or web serving of *.inc files, you should change these to *.php or *.inc.php files ASAP. Especially the first. You're looking at a

Re: [PHP] PHP variable values

2008-02-10 Thread Nathan Nobbe
On Feb 10, 2008 6:30 PM, Ron Piggott [EMAIL PROTECTED] wrote: What is the command which shows the value of all the variables in memory? Ron get_defined_vars() -nathan

[PHP] PHP variable values

2008-02-10 Thread Ron Piggott
What is the command which shows the value of all the variables in memory? Ron -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php

Fwd: [PHP] change php variable depending on selection

2008-01-21 Thread Nathan Nobbe
-- Forwarded message -- From: Nathan Nobbe [EMAIL PROTECTED] Date: Jan 21, 2008 10:43 AM Subject: Re: [PHP] change php variable depending on selection To: stp [EMAIL PROTECTED] On Jan 21, 2008 9:42 AM, stp [EMAIL PROTECTED] wrote: I'm sorry…..I've got the conversion

[PHP] change php variable depending on selection

2008-01-20 Thread PHP-General
I have stored. I can't seem to figure out how to, when you select matt'sblog (for example), how to make it so that the php variable will be populated with the rssfeed of matt's blog and then the feed will show. For instance, selecting matt'sblog from the drop down list will make it so that $url

Re: [PHP] change php variable depending on selection

2008-01-20 Thread Nathan Nobbe
the dropdown box so that it populates from my db the name of the blogs I have stored. I can't seem to figure out how to, when you select matt'sblog (for example), how to make it so that the php variable will be populated with the rssfeed of matt's blog and then the feed will show. For instance

Re: [PHP] change php variable depending on selection

2008-01-20 Thread PHP-General
of the blogs I have stored. I can't seem to figure out how to, when you select matt'sblog (for example), how to make it so that the php variable will be populated with the rssfeed of matt's blog and then the feed will show. For instance, selecting matt'sblog from the drop down list will make it so that $url

Re: [PHP] change php variable depending on selection

2008-01-20 Thread Nathan Nobbe
here is a complete, working example; hope it helps. http://nathan.moxune.com/exampleDynamicSelect.php -nathan

<    1   2   3   4   5   6   7   8   9   >