Simple sintax question

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
Perfidus
Forum Contributor
Posts: 114
Joined: Sun Nov 02, 2003 9:54 pm

Simple sintax question

Post by Perfidus »

How can I echo the value of

$jhonpeter = 3;

by using the vars:

$p = jhon;
$j = peter;

instead simply:

echo $jhonpeter;
User avatar
anjanesh
DevNet Resident
Posts: 1679
Joined: Sat Dec 06, 2003 9:52 pm
Location: Mumbai, India

Post by anjanesh »

Simple Syntax answer

Code: Select all

$jhonpeter = 3;
$p = "jhon";
$j = "peter";
$c = $p.$j;
echo $$c;
Post Reply