Variable variable use???

Ask about general coding issues or problems here.

Moderators: egami, macek, gesf

Post Reply
markosjal
New php-forum User
New php-forum User
Posts: 7
Joined: Tue Apr 24, 2018 3:43 am

Tue May 01, 2018 10:00 am

Is this a use for a variable variable?


I am setting up an app to use on a LAN . Security is not an issue.

Because the app must be multi lingual I want to use URL variables in the user's language. The user is actually encouraged to manipulate the URL variables as needed.

So my URL in English would look like
http://192.168.1.2/index.php?print=yes&crop=yes

My (same) URL in Spanish would look like
http://192.168.1.2/index.php?imprimir=si&recortar=si

Let me say as. Do not think k accented characters will work in a URL variable this way we will drop all accents.

Now I need to be able to define a single variable (variable variable?) For not only the translation of word yes/no but the condition or value as well . Is thiis a use for a variable variable and how would I attain this? Obviously I would GET from previous page and there is a variable defining language and language tables.

But let's say I need a new variable in the URL like day=Tuesday

How do I set the day corresponding to Tuesday (martes) as a variable ??

If ($lang='es')
$tuesday='martes';

elseif ($lang='en')
$tuesday='tuesday';

$day=$$day

But what would be needed in between?


Thanks

Mark

Post Reply