Posts Tagged ‘dynamic variable in php’

Dynamic variable names in PHP

August 18th, 2009 No comments

I'm going to show you how to use dynamic variable names in php. It's quite simple, just put your variable name in between {} symbols.

  1. // declare prefix. In a loop this would probably be a number.
  2. $prefix = "pfx";
  4. // build your variable
  5. ${"varname_{$prefix}"} = "success";
  7. //This would output "success"
  8. echo $varname_pfx;

Simple isn't it....

Become a dyneaming online video poker game player on the video poker games of where you can also learn the history of video poker !

SEO Powered by Platinum SEO from Techblissonline