Workaround for using number at beginning of variable name?

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
blckbrry
Forum Newbie
Posts: 3
Joined: Fri Jan 02, 2004 6:22 pm

Workaround for using number at beginning of variable name?

Post by blckbrry »

Is there a workaround for using a number at beginning of variable name?
I need to send variables received into my server side php page to a cgi script on another server. I can't change the variable names that I must send and they have names like: 2-name 3-name etc....
If I could use $2-name etc... that would be great, but I guess I can't. Any ideas?

Thanks!

Randall
User avatar
nigma
DevNet Resident
Posts: 1094
Joined: Sat Jan 25, 2003 1:49 am

Post by nigma »

Workaround: Don't use numbers at the beginning of a variable ;)

Why can't you use different var names? If I knew that then maybe together we could try to find a way to workaround the 'not being able to change the variable names'.
blckbrry
Forum Newbie
Posts: 3
Joined: Fri Jan 02, 2004 6:22 pm

reason for variable

Post by blckbrry »

I can't change the variable because the end cgi variable is processed by another company. Their cgi script is set up to receive "hidden" field variables from html Posts, and in that case having the naming "1-name" doesn't cause any problems. But I am trying to process in the background from Flash to PHP to their cgi script. You can't use numbers at the beginning of a variable name in actionscript either.
Does that explain more? Thank you!

Randall
User avatar
nigma
DevNet Resident
Posts: 1094
Joined: Sat Jan 25, 2003 1:49 am

Post by nigma »

Well if using Perl you can start your var names with a number then what you could do is:

1. Process the data with PHP using any variable name
2. When you're done processing with PHP you can send the user to a Perl script where the data that was processed on the PHP page is then moved to a name that works for the final Perl script(i.e. take whatever is in variable 'a' and put it variable '1').
3. After storing the processed data in a variable that is named according to guidlines then send the data off to the final Perl script (i.e. the companies Perl script)


Does this make sense? If not then let me know and I will try to explain my methodology more precisely.
blckbrry
Forum Newbie
Posts: 3
Joined: Fri Jan 02, 2004 6:22 pm

Post by blckbrry »

Thanks for the suggestion,
I will try to learn some Perl. I just have never used it before!
Randall
Post Reply