Using == will compare the two values after type juggling is performed. === will
compare based on value and type (identical).
PHP Will type juggle the string to an integer.
Your if/else is just like saying:
php> if (444 == "444") echo 'equal'; else echo 'not equal';
equal
--
Mike Mackintosh
P
On 12-06-21 10:27 PM, Daevid Vincent wrote:
Huh? Why is this equal??!
php> $id = '444-4';
php> var_dump($id, intval($id));
string(9) "444-4"
int(444)
php> if (intval($id) == $id) echo 'equal'; else echo 'not equal';
equal
or in othe
Huh? Why is this equal??!
php > $id = '444-4';
php > var_dump($id, intval($id));
string(9) "444-4"
int(444)
php > if (intval($id) == $id) echo 'equal'; else echo 'not equal';
equal
or in other words:
php > if (intval('444-4')
or you can do this
echo $row["Bible_knowledge_phrase_solver_game_question_topics_$i"];
-Original Message-
From: Ron Piggott [mailto:ron.pigg...@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']
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.
What needs to change? Ron
Ron Piggott
www.TheVe
6 matches
Mail list logo