Sorry if I'm missing something, there's a lot of replies after my first
post on this thread.
Is there something wrong with the "floor()" approach? I liked the regex
solution but isn't it more expensive and more verbose than just doing a
well commented "is_numeric" plus "floor/ceil" math?
Just try
On Sun, Mar 17, 2013 at 10:20 PM, Maciek Sokolewicz <
maciek.sokolew...@gmail.com> wrote:
> On 16-3-2013 19:20, Matijn Woudt wrote:
>
>> On Sat, Mar 16, 2013 at 6:52 PM, Maciek Sokolewicz <
>> maciek.sokolew...@gmail.com> wrote:
>>
>> Hi,
>>>
I have tried to find a way to check if a cha
On 16-3-2013 19:20, Matijn Woudt wrote:
On Sat, Mar 16, 2013 at 6:52 PM, Maciek Sokolewicz <
maciek.sokolew...@gmail.com> wrote:
Hi,
I have tried to find a way to check if a character string is possible to
test whether it is convertible to an intger !
any suggestion ?
BR georg
All respon
On Sat, Mar 16, 2013 at 12:21 PM, Ashley Sheridan
wrote:
>
> On Sat, 2013-03-16 at 11:46 -0400, Andrew Ballard wrote:
>
> On Mar 16, 2013 6:14 AM, "Ashley Sheridan" wrote:
> >
> > On Fri, 2013-03-15 at 22:32 -0400, Andrew Ballard wrote:
> >>
> >> > Guess regex are the only useful solution here. W
On Sat, Mar 16, 2013 at 6:52 PM, Maciek Sokolewicz <
maciek.sokolew...@gmail.com> wrote:
> Hi,
>>
>> I have tried to find a way to check if a character string is possible to
>> test whether it is convertible to an intger !
>>
>> any suggestion ?
>>
>> BR georg
>>
>
> All responses in this thread h
Hi,
I have tried to find a way to check if a character string is possible to
test whether it is convertible to an intger !
any suggestion ?
BR georg
All responses in this thread have been very nice; but you could also try
a much simpler 2-step check:
1. is_numeric
2. if true > check if the
On Sat, 2013-03-16 at 11:46 -0400, Andrew Ballard wrote:
> On Mar 16, 2013 6:14 AM, "Ashley Sheridan" wrote:
> >
> > On Fri, 2013-03-15 at 22:32 -0400, Andrew Ballard wrote:
> >>
> >> > Guess regex are the only useful solution here. When you consider to use
> >> > built-in functions, just remembe
On Mar 16, 2013 6:14 AM, "Ashley Sheridan" wrote:
>
> On Fri, 2013-03-15 at 22:32 -0400, Andrew Ballard wrote:
>>
>> > Guess regex are the only useful solution here. When you consider to use
>> > built-in functions, just remember, that for example '0xAF' is an
integer
>> > too, but '42.00' isn't.
On Fri, 2013-03-15 at 22:32 -0400, Andrew Ballard wrote:
> > Guess regex are the only useful solution here. When you consider to use
> > built-in functions, just remember, that for example '0xAF' is an integer
> > too, but '42.00' isn't.
>
> Shoot...I hadn't considered how PHP might handle hex or
On Fri, Mar 15, 2013 at 8:34 PM, Ashley Sheridan
wrote:
>>> > On Thu, Mar 14, 2013 at 7:02 PM,
>>georg
>>> >>> I have tried to find a way to check if a character string is
>>> >>> possible to
>>> >>> test whether it is convertible to an intger !
> The op wasn't about casting a str
On Sat, Mar 16, 2013 at 2:54 AM, Sebastian Krebs wrote:
> 2013/3/16 Andrew Ballard
>
> > I suppose one could try something like this:
> >
> > if (is_string($val) && $val === (string)(int)$val)
> >
> > If $val is an integer masquerading as a string, it should be identical to
> > the original
> Guess regex are the only useful solution here. When you consider to use
> built-in functions, just remember, that for example '0xAF' is an integer
> too, but '42.00' isn't.
Shoot...I hadn't considered how PHP might handle hex or octal strings when
casting to int. (Again, not in front of a comput
On Mar 15, 2013 9:54 PM, "Sebastian Krebs" wrote:
>
> 2013/3/16 Andrew Ballard
>>
>> I suppose one could try something like this:
>>
>> if (is_string($val) && $val === (string)(int)$val)
>>
>> If $val is an integer masquerading as a string, it should be identical to
>> the original string wh
2013/3/16 Andrew Ballard
> I suppose one could try something like this:
>
> if (is_string($val) && $val === (string)(int)$val)
>
> If $val is an integer masquerading as a string, it should be identical to
> the original string when cast back to a string, shouldn't it? (I can't try
> it right
2013/3/16 Ashley Sheridan
>
>
> tamouse mailing lists wrote:
>
> >On Fri, Mar 15, 2013 at 4:00 PM, Ashley Sheridan
> >wrote:
> >
> >> **
> >> On Fri, 2013-03-15 at 04:57 -0500, tamouse mailing lists wrote:
> >>
> >> On Fri, Mar 15, 2013 at 3:55 AM, Peter Ford
> >wrote:
> >> > On 15/03/13 06:21,
I suppose one could try something like this:
if (is_string($val) && $val === (string)(int)$val)
If $val is an integer masquerading as a string, it should be identical to
the original string when cast back to a string, shouldn't it? (I can't try
it right now.)
Andrew
tamouse mailing lists wrote:
>On Fri, Mar 15, 2013 at 4:00 PM, Ashley Sheridan
>wrote:
>
>> **
>> On Fri, 2013-03-15 at 04:57 -0500, tamouse mailing lists wrote:
>>
>> On Fri, Mar 15, 2013 at 3:55 AM, Peter Ford
>wrote:
>> > On 15/03/13 06:21, Jim Lucas wrote:
>> >>
>> >> On 3/14/2013 4:05 PM,
On Fri, Mar 15, 2013 at 4:00 PM, Ashley Sheridan
wrote:
> **
> On Fri, 2013-03-15 at 04:57 -0500, tamouse mailing lists wrote:
>
> On Fri, Mar 15, 2013 at 3:55 AM, Peter Ford wrote:
> > On 15/03/13 06:21, Jim Lucas wrote:
> >>
> >> On 3/14/2013 4:05 PM, Matijn Woudt wrote:
> >>>
> >>> On Thu, Mar
On 03/15/2013 02:33 PM, richard gray wrote:
On 15/03/2013 22:00, Ashley Sheridan wrote:
On Fri, 2013-03-15 at 04:57 -0500, tamouse mailing lists wrote:
For my money, `is_numeric()` does just what I want.
The thing is, is_numeric() will not check if a string is a valid int,
but any valid numb
On 15/03/2013 22:00, Ashley Sheridan wrote:
On Fri, 2013-03-15 at 04:57 -0500, tamouse mailing lists wrote:
For my money, `is_numeric()` does just what I want.
The thing is, is_numeric() will not check if a string is a valid int,
but any valid number, including a float.
For something like th
On Fri, 2013-03-15 at 04:57 -0500, tamouse mailing lists wrote:
> On Fri, Mar 15, 2013 at 3:55 AM, Peter Ford wrote:
> > On 15/03/13 06:21, Jim Lucas wrote:
> >>
> >> On 3/14/2013 4:05 PM, Matijn Woudt wrote:
> >>>
> >>> On Thu, Mar 14, 2013 at 11:44 PM, Jim Lucas wrote:
> >>>
> On 03/14/20
On 15/03/13 06:21, Jim Lucas wrote:
On 3/14/2013 4:05 PM, Matijn Woudt wrote:
On Thu, Mar 14, 2013 at 11:44 PM, Jim Lucas wrote:
On 03/14/2013 11:50 AM, Samuel Lopes Grigolato wrote:
Something like "if (is_numeric($var)&& $var == floor($var))" will do
the
trick. I don't know if there's a b
On 3/14/2013 4:05 PM, Matijn Woudt wrote:
On Thu, Mar 14, 2013 at 11:44 PM, Jim Lucas wrote:
On 03/14/2013 11:50 AM, Samuel Lopes Grigolato wrote:
Something like "if (is_numeric($var)&& $var == floor($var))" will do the
trick. I don't know if there's a better (more elegant) way.
On Thu,
On Thu, Mar 14, 2013 at 11:44 PM, Jim Lucas wrote:
> On 03/14/2013 11:50 AM, Samuel Lopes Grigolato wrote:
>
>> Something like "if (is_numeric($var)&& $var == floor($var))" will do the
>>
>> trick. I don't know if there's a better (more elegant) way.
>>
>>
>> On Thu, Mar 14, 2013 at 3:09 PM, Mat
On 03/14/2013 11:50 AM, Samuel Lopes Grigolato wrote:
Something like "if (is_numeric($var)&& $var == floor($var))" will do the
trick. I don't know if there's a better (more elegant) way.
On Thu, Mar 14, 2013 at 3:09 PM, Matijn Woudt wrote:
On Thu, Mar 14, 2013 at 7:02 PM, georg wrote:
Hi
Something like "if (is_numeric($var) && $var == floor($var))" will do the
trick. I don't know if there's a better (more elegant) way.
On Thu, Mar 14, 2013 at 3:09 PM, Matijn Woudt wrote:
> On Thu, Mar 14, 2013 at 7:02 PM, georg wrote:
>
> > Hi,
> >
> > I have tried to find a way to check if a
On Thu, Mar 14, 2013 at 7:02 PM, georg wrote:
> Hi,
>
> I have tried to find a way to check if a character string is possible to
> test whether it is convertible to an intger !
>
> any suggestion ?
>
> BR georg
You could use is_numeric for that, though it also accepts floats.
- Matijn
On Sat, 5 Jan 2013 04:20:09 -0600, Kevin Kinsey wrote:
> Nelson (et al),
>
> I've enjoyed reading this thread and apologize for dredging it up.
> It's interesting to see your progression of thought and the templating
> discussion is indeed a worthy one.
>
> However, I wanted to answer this object
On Mon, Dec 31, 2012 at 02:29:38PM -0600, Nelson Green wrote:
>
> On Mon, 31 Dec 2012 19:59:02, Ashley Sheridan wrote:
> ___
> >
> > On Mon, 2012-12-31 at 13:39 -0600, Nelson Green wrote:
>
Nelson (et al),
I've enjoyed reading this thread and apologize for dredg
> While using the *_once works in many cases, if you're doing a mass
> mailing kind of thing, you want to use the standard include/require so
> you can re-include it as your variables change:
>
> foreach ($customers as $customer) {
> $fullname = $customer['fullname'];
> $address = $customer['addre
On Mon, Dec 31, 2012 at 5:47 PM, Stephen wrote:
> The common stuff for every page is defined in the file "include.php". I
> define the variable $markup in that file.
>
> Here is the definition for $markup
>
> $markup=<< HEREDOC;
>
> By using require_once instead of fopen and fread, I have simpler
On 12-12-31 03:37 PM, Nelson Green wrote:
On Mon, 31 Dec 2012 14:47:20 Stephen D wrote:
Yes!
Easy standard stuff.
$title = 'Mr.";
$user_name = 'John Doe';
$message = "Hello $title $user_name "
Just define the value for the variables before defining the value for
the message.
Note that $
On 2012-12-31, at 4:58 PM, tamouse mailing lists
wrote:
> I use the include("template") method for this alla time, it works
> great. Most especially for HTML emails coming from a web site to a
> group of users, just slick as anything. include does basically just
> what your print_greeting functi
Bastien Koert
On 2012-12-31, at 4:58 PM, tamouse mailing lists
wrote:
> On Mon, Dec 31, 2012 at 2:37 PM, Nelson Green
> wrote:
>>
>> On Mon, 31 Dec 2012 14:47:20 Stephen D wrote:
>>>
>>> Yes!
>>>
>>> Easy standard stuff.
>>>
>>> $title = 'Mr.";
>>> $user_name = 'John Doe';
>>>
>>> $mes
On Mon, Dec 31, 2012 at 2:37 PM, Nelson Green wrote:
>
> On Mon, 31 Dec 2012 14:47:20 Stephen D wrote:
>>
>> Yes!
>>
>> Easy standard stuff.
>>
>> $title = 'Mr.";
>> $user_name = 'John Doe';
>>
>> $message = "Hello $title $user_name "
>>
>> Just define the value for the variables before defini
On Mon, 31 Dec 2012 14:47:20 Stephen D wrote:
>
> Yes!
>
> Easy standard stuff.
>
> $title = 'Mr.";
> $user_name = 'John Doe';
>
> $message = "Hello $title $user_name "
>
> Just define the value for the variables before defining the value for
> the message.
>
> Note that $message has to use do
On Mon, 31 Dec 2012 19:59:02, Ashley Sheridan wrote:
___
>
> On Mon, 2012-12-31 at 13:39 -0600, Nelson Green wrote:
> My question is, is there another way to do something similar, such as
> embedding a variable name directly into the text file? In other words,
>
Please excuse the top post, but this may be helpful:
http://stut.net/2008/10/28/snippet-simple-templates-with-php/
-Stuart
--
Sent from my leaf blower
On 31 Dec 2012, at 19:59, Ashley Sheridan wrote:
> On Mon, 2012-12-31 at 13:39 -0600, Nelson Green wrote:
>
>> Hello,
>>
>> I have created
On Mon, 2012-12-31 at 13:39 -0600, Nelson Green wrote:
> Hello,
>
> I have created a simple function that prints a personalized greeting by
> reading
> the greeting contents from a file. I pass the user's name to the function,
> and the function reads the file contents into a string variable. I
Yes!
Easy standard stuff.
$title = 'Mr.";
$user_name = 'John Doe';
$message = "Hello $title $user_name "
Just define the value for the variables before defining the value for
the message.
Note that $message has to use double quotes for the expansion. Also
consider using HEREDOC instead
or you can do this
echo $row["Bible_knowledge_phrase_solver_game_question_topics_$i"];
-Original Message-
From: Ron Piggott [mailto:ron.pigg...@actsministries.org]
Sent: Thursday, June 21, 2012 3:47 AM
To: php-general@lists.php.net
Subject: [PHP] Variable representation
I am trying to represent the variable:
$row['Bible_knowledge_phrase_solver_game_question_topics_1']
On 04/19/2012 09:55 AM, Christoph Boget wrote:
>> I am trying to use this while look to assign them to variables:
>> $word_1
>> $word_2
>> $word_3
>> ...
>> $word_25
>
> This should work for you:
>
> http://us3.php.net/manual/en/function.extract.php
>
> thnx,
> Christoph
Yes and you can use arr
> I am trying to use this while look to assign them to variables:
> $word_1
> $word_2
> $word_3
> ...
> $word_25
This should work for you:
http://us3.php.net/manual/en/function.extract.php
thnx,
Christoph
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.n
On 19 Apr 2012, at 15:46, Ron Piggott wrote:
> I am trying to assign variables from an array into variables. This is
> following a database query. Right now they are in an array:
>
> $row[‘word_1’]
> $row[‘word_2’]
> $row[‘word_3’]
> ...
> $row[‘word_25’]
Why those indices? Why isn't it just
On Mon, Apr 2, 2012 at 4:34 AM, Maciek Sokolewicz
wrote:
> Usually if you think you need to use eval: think again. In this case, it
> again holds true.
>
> Instead of doing what you do, you can also reference the variable as:
> echo ${'image_'.$i};
> or
> echo $GLOBALS['image_'.$i];
>
> Both are p
On 02-04-2012 07:15, tamouse mailing lists wrote:
As for doing what you originally asked, that requires doing an eval()
on the statement utilizing string interpolation, like so:
eval('echo "image $i is $image_' . $i . '".PHP_EOL;');
but I think that's a bit harder to read and understand what
On Mon, Apr 2, 2012 at 12:20 AM, tamouse mailing lists
wrote:
> Ugh, gmail mangled the code there. Here's a pastebin of the response
> which is better formatted: http://pastie.org/3712761
Sweet. I spent so long on my reply, two others snuck in before me. :)
--
PHP General Mailing List (http://w
Ugh, gmail mangled the code there. Here's a pastebin of the response
which is better formatted: http://pastie.org/3712761
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
On Sun, Apr 1, 2012 at 10:52 PM, Ron Piggott
wrote:
> Hi Everyone:
>
> I am assigning the value of 4 images to variables following a database query:
>
> $image_1 = stripslashes( $row['image_1'] );
> $image_2 = stripslashes( $row['image_2'] );
> $image_3 = stripslashes( $row['image_3'] );
> $image_
On 04/02/2012 07:46 AM, Adam Randall wrote:
$images[] = stripslashes( $row['image_1'] );
$images[] = stripslashes( $row['image_2'] );
$images[] = stripslashes( $row['image_3'] );
$images[] = stripslashes( $row['image_4'] );
$images[1] = stripslashes( $row['image_1'] );
$images[2] = strips
On 04/02/2012 06:52 AM, Ron Piggott wrote:
$image_1 = stripslashes( $row['image_1'] );
$image_2 = stripslashes( $row['image_2'] );
$image_3 = stripslashes( $row['image_3'] );
$image_4 = stripslashes( $row['image_4'] );
[...] (Not all 4 variables have an image.)
How is it meant in the database?
It would better to just use an array, and then iterate through that.
$images[] = stripslashes( $row['image_1'] );
$images[] = stripslashes( $row['image_2'] );
$images[] = stripslashes( $row['image_3'] );
$images[] = stripslashes( $row['image_4'] );
foreach( $images as $k => $v ) {
$k++; /
On 12 Feb 2012 at 19:01, Stuart Dallas wrote:
> Optional arguments must be given a default value...
>
> function my_func(&$arg1, $arg2, $arg3, $arg4 = null, $arg5 = null, &$arg6 =
> null)
>
> Note that passing a default value by reference was not supported prior to
> PHP5.
>
> All the relevant d
On 12 Feb 2012, at 18:51, Tim Streater wrote:
> I have a function defined thus:
>
> function my_func (&$arg1, $arg2, $arg3, $arg4, $arg5, &$arg6)
> {
>
> // code here
>
> }
>
> I call this with variously the first three arguments only, or all six, taking
> care that if I call it w
Jim Lucas wrote:
[snip]
if (!isset($pmatch) || substr($key,0,strlen($pmatch)) == $pmatch) {
print "$key = $value";
}
[snip]
I would change the above the the following:
if ( empty($pmatch) || ( strpos($key, $pmatch) === 0 ) ) {
print "$key = $value";
}
it would be slightly faster
love th
On 01/09/2012 07:16 PM, Donovan Brooke wrote:
Just to share, a Mr. Harkness forwarded me a consolidated version of my
code.. basically substituting the innards for:
if (!isset($pmatch) || substr($key,0,strlen($pmatch)) == $pmatch) {
print "$key = $value";
}
Cheers,
Donovan
I would change
Just to share, a Mr. Harkness forwarded me a consolidated version of my
code.. basically substituting the innards for:
if (!isset($pmatch) || substr($key,0,strlen($pmatch)) == $pmatch) {
print "$key = $value";
}
Cheers,
Donovan
--
D Brooke
--
PHP General Mailing List (http://www.php.ne
On Mon, Jan 09, 2012 at 10:42:59AM -0500, Marc Guay wrote:
> > some pretty natives php functions exists to do the job :
>
> But how many times in my life will I have write echo ""; ???
> Does anyone have a handy solution? (Make this the default behavior?
> Add a "even more human-readable" flag to
Ashley Sheridan wrote:
>
>
>Marc Guay wrote:
>
>>> some pretty natives php functions exists to do the job :
>>
>>But how many times in my life will I have write echo ""; ???
>>Does anyone have a handy solution? (Make this the default behavior?
>>Add a "even more human-readable" flag to the fun
Marc Guay wrote:
>> some pretty natives php functions exists to do the job :
>
>But how many times in my life will I have write echo ""; ???
>Does anyone have a handy solution? (Make this the default behavior?
>Add a "even more human-readable" flag to the function? Create a
>simple macro in Ap
> some pretty natives php functions exists to do the job :
But how many times in my life will I have write echo ""; ???
Does anyone have a handy solution? (Make this the default behavior?
Add a "even more human-readable" flag to the function? Create a
simple macro in Aptana 3?)
Argz,
Marc
--
P
Hi,
some pretty natives php functions exists to do the job :
var_export — Outputs or returns a parsable string representation of a variable
debug_zval_dump — Dumps a string representation of an internal zend value to
output
var_dump — Dumps information about a variable
print_r — Prints human-read
> $var = constant('DESKTOP_URL_' . $_SESSION['lang']);
Very nice, thank you.
Marc
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
On 10/12/11 11:51, "Marc Guay" wrote:
>Let's say that I have 2 constants
>
>DEFINE('DESKTOP_URL_en', "http://www.website.com/index.php?page=home";);
>DEFINE('DESKTOP_URL_fr',
>"http://www.website.com/index.php?page=accueil";);
>
>and I would like to populate the value of an href with them depend
> -Original Message-
> From: Ron Piggott [mailto:ron@actsministries.org]
> Sent: 01 October 2011 18:59
> To: php-general@lists.php.net
> Subject: [PHP] Variable question
>
>
> If $correct_answer has a value of 3 what is the correct syntax
> needed to use echo to display the value of $
On Sat, 1 Oct 2011, Mike Mackintosh wrote:
Best bet would to toss this into either an object or array for
simplification, otherwise that type of syntax would need the use of
eval.
example: eval('echo $trivia_answer_'.$correct_answer.';');
You could do:
$var = "trivia_answer_.$correct_ans
On 01 Oct 2011 at 18:59, Ron Piggott wrote:
> If $correct_answer has a value of 3 what is the correct syntax needed to use
> echo to display the value of $trivia_answer_3?
>
> I know this is incorrect, but along the lines of what I am wanting to do:
>
> echo $trivia_answer_$correct_answer;
>
> $
On 11-10-01 02:03 PM, Mike Mackintosh wrote:
On Oct 1, 2011, at 1:59 PM, Ron Piggott wrote:
If $correct_answer has a value of 3 what is the correct syntax needed to use
echo to display the value of $trivia_answer_3?
I know this is incorrect, but along the lines of what I am wanting to do:
On Sat, Oct 1, 2011 at 10:59 AM, Ron Piggott wrote:
> If $correct_answer has a value of 3 what is the correct syntax needed to
> use echo to display the value of $trivia_answer_3?
You can use variable variables [1] to access the variable by building its
name in a string:
$name = 'trivia_ans
On Oct 1, 2011, at 1:59 PM, Ron Piggott wrote:
>
> If $correct_answer has a value of 3 what is the correct syntax needed to use
> echo to display the value of $trivia_answer_3?
>
> I know this is incorrect, but along the lines of what I am wanting to do:
>
> echo $trivia_answer_$correct_answe
On Jul 14, 2011, at 3:54 PM, Karl DeSaulniers wrote:
Can anyone explain this to me.
function sendEmail($uname,$subjField,$firstname,$lastname,$email,
$reply,$e_cc,$e_bcc,$comments,$ip,$Date,$time){
$uname = trim($uname);
$subjField = trim($subjField);
$firstname = trim($firstname);
Gentlemen,
Thank you. The "Thing1 Thing2" approach worked.
>If you have total control over application A which contains the bridge
>code, the easiest is to change it to use a different global variable.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.n
If you have total control over application A which contains the bridge code,
the easiest is to change it to use a different global variable, $dbA. This
must not be doable or you wouldn't have asked.
If you have control over the bridge code, and it alone calls A and B, then
you could swap the $db v
Short of refactoring ApplicationB, can you set it up as a SOAP/REST service
that AppA calls?
On Tue, Oct 5, 2010 at 5:02 PM, Brian Smither wrote:
>
> >Just to clarify, both packages are instantiating and calling their
> >respective classes from the $db var, which is in the global scope.
> >Is t
>Just to clarify, both packages are instantiating and calling their
>respective classes from the $db var, which is in the global scope.
>Is this correct?
I would say yes to the way you are asking. Take the following two applications.
The four respective statements are in each their respective sc
Just to clarify, both packages are instantiating and calling their
respective database classes from the $db var, which is in the global scope.
Is this correct?
This is why I hate the global scope, I hate it, I hate it!
On Tue, Oct 5, 2010 at 3:47 PM, Brian Smither wrote:
> I am running into a v
Really cool...
Thanks and fogive me by my mistake. hehe
--
João Cândido de Souza Neto
"Robert Cummings" escreveu na mensagem
news:4c76743a.2060...@interjinn.com...
> On 10-08-26 09:54 AM, João Cândido de Souza Neto wrote:
>> I know that in PHP I can use this:
>>
>> $var1 = "text";
>> $var
On 10-08-26 09:54 AM, João Cândido de Souza Neto wrote:
I know that in PHP I can use this:
$var1 = "text";
$var2 = '$var1';
4cho $$var2;
So it gives me "text".
It would if you didn't have typos and the wrong quotes in the above :)
My question is, is there a way of doing it with constant l
On 11 August 2010 13:58, Bob McConnell wrote:
> From: Richard Quadling
>
>> Quick set of eyes needed to see what I've done wrong...
>>
>> The following is a reduced example ...
>>
>> > $Set = array();
>> $Entry = 'Set[1]';
> ^^
> Shouldn't that be $Set[1]?
>
>> $Value = 'Assigned';
From: Richard Quadling
> Quick set of eyes needed to see what I've done wrong...
>
> The following is a reduced example ...
>
> $Set = array();
> $Entry = 'Set[1]';
^^
Shouldn't that be $Set[1]?
> $Value = 'Assigned';
> $$Entry = $Value;
> print_r($Set);
> ?>
Bob McConnell
--
On 10 August 2010 18:08, Andrew Ballard wrote:
> On Tue, Aug 10, 2010 at 12:23 PM, Richard Quadling
> wrote:
>> On 10 August 2010 16:49, Jim Lucas wrote:
>>> Richard Quadling wrote:
Hi.
Quick set of eyes needed to see what I've done wrong...
The following is a redu
On Tue, Aug 10, 2010 at 12:23 PM, Richard Quadling wrote:
> On 10 August 2010 16:49, Jim Lucas wrote:
>> Richard Quadling wrote:
>>>
>>> Hi.
>>>
>>> Quick set of eyes needed to see what I've done wrong...
>>>
>>> The following is a reduced example ...
>>>
>>> >> $Set = array();
>>> $Entry = 'Set[
On 10 August 2010 16:49, Jim Lucas wrote:
> Richard Quadling wrote:
>>
>> Hi.
>>
>> Quick set of eyes needed to see what I've done wrong...
>>
>> The following is a reduced example ...
>>
>> > $Set = array();
>> $Entry = 'Set[1]';
>> $Value = 'Assigned';
>> $$Entry = $Value;
>> print_r($Set);
>> ?
Richard Quadling wrote:
Hi.
Quick set of eyes needed to see what I've done wrong...
The following is a reduced example ...
The output is an empty array.
Examining $GLOBALS, I end up with an entries ...
[Set] => Array
(
)
[Entry] => Set[1]
[Value] => Assigned
Thanks, all! I will experiment with the three different solutions
presented and see what best fits this application. As to the security
aspect, yes, I am aware that this is a simplification and that the
values must be sanitized.
Have a great week.
--
Dotan Cohen
http://what-is-what.com
http://g
On Mon, 5 Oct 2009 16:56:48 +0200
Dotan Cohen wrote:
> I need to store a variable name as a variable. Note quite a C-style
> pointer, but a way to access one variable who's name is stored in
> another variable.
>
> As part of a spam-control measure, a certain public-facing form will
> have dummy
- Original Message
> From: Dotan Cohen
> To: php-general.
> Sent: Mon, October 5, 2009 7:56:48 AM
> Subject: [PHP] Variable name as a variable?
>
> I need to store a variable name as a variable. Note quite a C-style
> pointer, but a way to access one variable who's name is stored in
> a
On Mon, 2009-10-05 at 16:56 +0200, Dotan Cohen wrote:
> I need to store a variable name as a variable. Note quite a C-style
> pointer, but a way to access one variable who's name is stored in
> another variable.
>
> As part of a spam-control measure, a certain public-facing form will
> have dummy
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 th
> 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 t
- Original Message
> From: Tommy Pham
> To: Grega Leskovšek ; 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@li
- Original Message
> From: Grega Leskovšek
> 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 $item0 using
Rick Duval wrote:
I'm using an "OnClick" routine to set a session variable before I go
to another page.
onClick= works fine but I
need a variable where "rick" is
I've tried
onClick=
and other variations but it doesn't work.
Can anybody tell me what the proper formatting is to get this to
r
"Chris" 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 it that
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.
--
"Ashley Sheridan" 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 already defined error
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
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
>com
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)
1 - 100 of 547 matches
Mail list logo