RE: [PHP] Variable representation

From: Date: Thu, 21 Jun 2012 07:59:32 +0000
Subject: RE: [PHP] Variable representation
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-318282@lists.php.net to get a copy of this message
-----Original Message----- From: Ron Piggott [mailto:ron.piggott@actsministries.org] Sent: Thursday, June 21, 2012 3:47 AM To: php-general@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 -------------------------------------------- You can do this echo $row['Bible_knowledge_phrase_solver_game_question_topics_'.$i]; I would not suggest a variable name that long.

« previous php.general (#318282) next »