Re: [PHP] How to use string as variable name?

2002-11-21 Thread -[ Rene Brehmer ]-
Hi Adam Voigt,

On 18 Nov 2002 13:11:30 -0500, you wrote about Re: [PHP] How to use
string as variable name? something that looked like this:

$date = 2002-11-22;
$myvar = a . str_replace(-,,$date);
$$myvar = hi;

echo $a20021122;

GREAT ... works right off ..thx a billion ... 

Rene


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




[PHP] How to use string as variable name?

2002-11-18 Thread -[ Rene Brehmer ]-
Hi gang

I'm suffering under the lack of an SQL, which would've made this loads
easier, so instead I'm forced at using a bunch of arrays to keep track of
the info instead...

But here's the prob: I'm working on a list of premieredates for movies.
Here's the HTML version I made to figure out how to make it into PHP:
http://metalbunny.net/dk/film/
(it's in Danish, don't let that confuse you).

The current one is static HTML, but I want it to be dynamic PHP, as it,
naturally, will make it easier to add to/update the list.

So, without the benefit of a database, I'm using arrays, as this:

// array with premiere dates
$premieredag =
array(2002-11-22,2002-11-29,2002-12-06,2002-12-18,2002-12-25,2003-01-03,2003-01-17,2003-01-24);

// each date has its own array, with partial filenames for each movie
$d20021122 = array(001);
$d20021129 = array(002,003,004);
$d20021206 = array(005,006,007);

// ... and so on ...

I need the string from $premieredag to build the date heading. But want I
want to do, is to be able to convert the string contents into the variable
name used for each date's array ...

so that I pull $premieredag[0] and convert the string from 2002-11-22
into $d20021122, which is easy enough, as a string, but how can I make PHP
understand that I want to pull data from the array that is named that???
Current experimental design gives nothing but errors ... so it's useless
...
How do you convert a string value into a variable name???

Lost here ... I've only ever done something like this once in JS a looong
time ago, and can't even remember how...

TIA

Rene

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] How to use string as variable name?

2002-11-18 Thread Adam Voigt
$date = 2002-11-22;
$myvar = a . str_replace(-,,$date);
$$myvar = hi;

echo $a20021122;

Enjoy.

On Mon, 2002-11-18 at 13:05, -[ Rene Brehmer ]- wrote:
 Hi gang
 
 I'm suffering under the lack of an SQL, which would've made this loads
 easier, so instead I'm forced at using a bunch of arrays to keep track of
 the info instead...
 
 But here's the prob: I'm working on a list of premieredates for movies.
 Here's the HTML version I made to figure out how to make it into PHP:
 http://metalbunny.net/dk/film/
 (it's in Danish, don't let that confuse you).
 
 The current one is static HTML, but I want it to be dynamic PHP, as it,
 naturally, will make it easier to add to/update the list.
 
 So, without the benefit of a database, I'm using arrays, as this:
 
 // array with premiere dates
 $premieredag =
 
array(2002-11-22,2002-11-29,2002-12-06,2002-12-18,2002-12-25,2003-01-03,2003-01-17,2003-01-24);
 
 // each date has its own array, with partial filenames for each movie
 $d20021122 = array(001);
 $d20021129 = array(002,003,004);
 $d20021206 = array(005,006,007);
 
 // ... and so on ...
 
 I need the string from $premieredag to build the date heading. But want I
 want to do, is to be able to convert the string contents into the variable
 name used for each date's array ...
 
 so that I pull $premieredag[0] and convert the string from 2002-11-22
 into $d20021122, which is easy enough, as a string, but how can I make PHP
 understand that I want to pull data from the array that is named that???
 Current experimental design gives nothing but errors ... so it's useless
 ...
 How do you convert a string value into a variable name???
 
 Lost here ... I've only ever done something like this once in JS a looong
 time ago, and can't even remember how...
 
 TIA
 
 Rene
 
 -- 
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 
-- 
Adam Voigt ([EMAIL PROTECTED])
The Cryptocomm Group
My GPG Key: http://64.238.252.49:8080/adam_at_cryptocomm.asc



signature.asc
Description: This is a digitally signed message part


Re: [PHP] How to use string as variable name?

2002-11-18 Thread Marek Kilimajer
Convert $day=2002-11-22 to just $day=d20021122 and $$day will be 
really $d20021122


-[ Rene Brehmer ]- wrote:

Hi gang

I'm suffering under the lack of an SQL, which would've made this loads
easier, so instead I'm forced at using a bunch of arrays to keep track of
the info instead...

But here's the prob: I'm working on a list of premieredates for movies.
Here's the HTML version I made to figure out how to make it into PHP:
http://metalbunny.net/dk/film/
(it's in Danish, don't let that confuse you).

The current one is static HTML, but I want it to be dynamic PHP, as it,
naturally, will make it easier to add to/update the list.

So, without the benefit of a database, I'm using arrays, as this:

// array with premiere dates
$premieredag =
array(2002-11-22,2002-11-29,2002-12-06,2002-12-18,2002-12-25,2003-01-03,2003-01-17,2003-01-24);

// each date has its own array, with partial filenames for each movie
$d20021122 = array(001);
$d20021129 = array(002,003,004);
$d20021206 = array(005,006,007);

// ... and so on ...

I need the string from $premieredag to build the date heading. But want I
want to do, is to be able to convert the string contents into the variable
name used for each date's array ...

so that I pull $premieredag[0] and convert the string from 2002-11-22
into $d20021122, which is easy enough, as a string, but how can I make PHP
understand that I want to pull data from the array that is named that???
Current experimental design gives nothing but errors ... so it's useless
...
How do you convert a string value into a variable name???

Lost here ... I've only ever done something like this once in JS a looong
time ago, and can't even remember how...

TIA

Rene

 



--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php