Category: php

.

Variable Variables in PHP

Every so often when you are writing a php file, we all run into a situation where we would like for the name of the

string that is inside of your php variable to be converted into the actual name of another variable.

After a fair amount of hunting around the internet and getting sent off into PHP code hunting limbo for a few hours, I suddenly remembered that this was something that I had  found a solution to some time ago. Now, had I been prudent about my little discovery, I would have put it up here on mrarrowhead.com. Instead I forgot about it until I accidentally ran across variable variables agains in the php manual. Variable variables was exactly what I was looking for to get a string from one variable and change it to the name of another variable in my php scipt.

So here goes:

 

<php

$var = varIwannaMake;

$$var = Im in varIwannaMake;

echo $$var. //<--- this will output the above sentence;

echo $varIwannaMake; // this will output the same thing

 

?>

 

The scirpt above will output the following:

Im in varIwannaMake

Im in varIwannaMake

 

Short and sweet  - simple to use -- hope you like.

 

 

 

Author: D.Shaun Morgan

how to use dreamweaver Dreamweaver - WISIWIG Dreamweaver is a tool that arguably could be called the industry standard for web design . Dreamweaver, is an Adobe product that originally b

Filezilla Filezilla Ftp Client, FTP SERVER vs Wsftp By: D.Shaun Morgan While I was writing this article, about halfway through, I realized that it would be unfair to tell my readers about

how to open create write files php Php file functions, Opening a file in php, reading a file in php, writing a file in php In this tutorial we will look at the most commonly used file functions used in php. The

register globals long arrays php Security, php.ini, register_globals and register_long_arrays Author: D.Shaun Morgan Versions and Skill Level PHP Version - PHP 5x

how to install php 5 php This is a quick start beginner's how-to manual explaining how to quickly setup a PHP 5 installation on a Windows XP PC. You must have an Apache webserver installed and working on your personal comp

.

 

Leave a Comment

how-to-turn-variable-value-into-variable-name

Name:      | Email:      | Website:

Comment:


captcha

Enter The Above Security Code: