setting a varialbe in PHP


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting setting a varialbe in PHP
# 1  
Old 02-19-2010
setting a varialbe in PHP

This is a re-post of a previous topic. However I'm simplifying it to hopefully get a response this time.

Given the following variables:

Code:
$id = "home";
$home=array("4.8","2.3");

I want to combine these variables to print the first number in the array.

This doesn't work:

Code:
echo "$[$id][0]";

Should print the number 4.8. The variable "id" is dynamic and can be a variety of names in a given while loop. That is why it isn't as simple as calling the array itself. Really what I want to know is how the syntax in php works for defining variables with variables. Any ideas?

thanks in advance,

Dave
# 2  
Old 02-19-2010
Double post, continued here
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Solaris

Is there a difference between setting a user as nologin and setting it as a role?

Trying to figure out the best method of security for oracle user accounts. In Solaris 10 they are set as regular users but have nologin set forcing the dev's to login as themselves and then su to the oracle users. In Solaris11 we have the option of making it a role because RBAC is enabled but... (1 Reply)
Discussion started by: os2mac
1 Replies

2. UNIX for Dummies Questions & Answers

Setting up cron

Hi, The client wants to set up cronjob for trigger alerts to be sent between the hours of 6 AM PST and 12 AM PST . Could you please help me the command to setup cron. scriptname :- triggeralert.ksh Thanks in advance (16 Replies)
Discussion started by: kirankumar
16 Replies

3. AIX

Setting up Printer

Hi All, This is katherine and I am kind of new to AIX and has got the following request to set up the printer. Can anybody guide me to fullfill the following request step by step. The request is as follows: "We have been asked to set up the following printer in Oracle: UNIX queue ... (1 Reply)
Discussion started by: katherine2008
1 Replies

4. Shell Programming and Scripting

[PHP] Setting a Superglobal from the Shell ?

Hey, Does anyone know if it is possible to set a PHP Superglobal variable (in an Apache2 working environment) from the shell or command line? I tried to set one like this by creating a file env.php with this: <?php $_ENV = 'YEAME'; ?> And I executed as root with: php env.php ... (0 Replies)
Discussion started by: Neo
0 Replies

5. BSD

Setting up Apache/mySQL/PHP in Jail

Server: FreeBSD 7.2-Release Previously I admin a website that uses IP.Board as a forum. It was on a FreeBSD server but there were some issues with some other people on the server so the whole server has been resetup. It is has been set up as a Unix Jail and I was given root access. Apache has... (3 Replies)
Discussion started by: Dark Severance
3 Replies

6. Shell Programming and Scripting

Setting cronjobs...

Hi, We have 4 jobs to be run every month on different times - * a daily job runs once in 2 days at 3PM *a weekly runs every thursday at 3PM * a monthly runs last day of month either 30 or 31st at 3PM * 4th job runs on 3rd of every month at 3Pm How can I set the crontab for these 4 jobs... (4 Replies)
Discussion started by: krworks
4 Replies

7. UNIX for Advanced & Expert Users

setting some variables

i have a file .NAMEexport MY_NAME=JOE when i do this at the command prompt #. .NAME $echo MY_NAME $JOEi created a script called Run.sh . .NAME At the command prompt i did #sh Run.sh #echo $MY_NAMEit returns nothing. What have i missed out? (7 Replies)
Discussion started by: new2ss
7 Replies

8. AIX

setting acl

Hi, I want to know how to set acl in aix via smitty and shell prompt, wheather we needs to install additional packages. (0 Replies)
Discussion started by: manoj.solaris
0 Replies

9. UNIX for Dummies Questions & Answers

New ip setting

I want to change the IPsetting and the broadcast setting. With ipconfig I get this: hme0: flags=1000843<UP,BROADCAST,RUNNING,MULTICAST,IPv4> mtu 1500 index 2 inet xx.17x.18x.xx netmask fffffff0 broadcast xx.17x.18x.xx ether yy:0:yy:b6:yy:xx What command(squence) do I use to... (6 Replies)
Discussion started by: kuultak
6 Replies

10. Solaris

Setting up NIS

I'm some what new to Unix and I recently have been thrown into a system administration role. I created this thread because I I wish to setup NIS in my lab and I thought this could be benificial to me and many others. I am followig the Sun System Administation Guide: Naming and Directory... (9 Replies)
Discussion started by: meyersp
9 Replies
Login or Register to Ask a Question