Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
?
Solved

create a new var

Posted on 2003-03-04
2
Medium Priority
?
213 Views
Last Modified: 2010-05-18
I would like to create a new var:
$i=3;
$a="test";

Now I need to create e new var, called b_3 with value of var a: "test"
In ASP it's
execute("b_"&i"="&a)


0
Comment
Question by:moswa
2 Comments
 
LVL 15

Accepted Solution

by:
OMC2000 earned 200 total points
ID: 8063195
I guess you mean something like eval, don't you?

<?php
$i = 3;
$a = 'test';
eval ("\$b_$i = \"$a\";");
echo $b_3;
?>
0
 
LVL 6

Expert Comment

by:christopher sagayam
ID: 8063218
you can use

$i=3;
$a="test";

$c = "b_".$i;

$$c = $a;

0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Part of the Global Positioning System A geocode (https://developers.google.com/maps/documentation/geocoding/) is the major subset of a GPS coordinate (http://en.wikipedia.org/wiki/Global_Positioning_System), the other parts being the altitude and t…
Many old projects have bad code, but the budget doesn't exist to rewrite the codebase. You can update this code to be safer by introducing contemporary input validation, sanitation, and safer database queries.
Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …
Suggested Courses

564 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question