Ron Piggott | 21 Jun 2012 09:47

Variable representation


I am trying to represent the variable:
$row['Bible_knowledge_phrase_solver_game_question_topics_1'] 
Where the # 1 is replaced by a variable --- $i

The following code executes without an error, but “Hello world” doesn’t show on the screen.

<?php

$row['Bible_knowledge_phrase_solver_game_question_topics_1'] = "hello world";

$i = 1;

echo ${"row['Bible_knowledge_phrase_solver_game_question_topics_$i']"};

?>

What needs to change?  Ron

Ron Piggott

www.TheVerseOfTheDay.info 
admin | 21 Jun 2012 09:59

RE: Variable representation


-----Original Message-----
From: Ron Piggott [mailto:ron.piggott <at> actsministries.org] 
Sent: Thursday, June 21, 2012 3:47 AM
To: php-general <at> lists.php.net
Subject: [PHP] Variable representation

I am trying to represent the variable:
$row['Bible_knowledge_phrase_solver_game_question_topics_1'] 
Where the # 1 is replaced by a variable --- $i

The following code executes without an error, but “Hello world” doesn’t show on the screen.

<?php

$row['Bible_knowledge_phrase_solver_game_question_topics_1'] = "hello world";

$i = 1;

echo ${"row['Bible_knowledge_phrase_solver_game_question_topics_$i']"};

?>

What needs to change?  Ron

Ron Piggott

www.TheVerseOfTheDay.info 

--------------------------------------------
(Continue reading)

As'ad Djamalilleil | 21 Jun 2012 12:49
Picon

Re: Variable representation

or you can do this
echo $row["Bible_knowledge_phrase_solver_game_question_topics_$i"];

Gmane