|
Smarty
WARNING: All discussion is moving to https://reddit.com/r/smarty, please go there! This forum will be closing soon. |
|
View previous topic :: View next topic |
Author |
Message |
stingtao Smarty Rookie
Joined: 15 Jan 2006 Posts: 5
|
|
Back to top |
|
stingtao Smarty Rookie
Joined: 15 Jan 2006 Posts: 5
|
Posted: Sun Jan 15, 2006 5:03 pm Post subject: a sample code: please tell me why. Help needed! |
|
|
Code: |
{assign var="temp" value=$joinedstatus[reply_status]->invitation}
<br>joined status => {$temp}
<br>check_secret => {$invitation}
<br>compare =>
{if $temp eq $invitation}
<br>SHOW means "{$temp}" equal "{$invitation}"
{/if}
|
the above code generate the following result:
Quote: |
joined status => ysoyzdhw6f
check_secret => 0
compare =>
SHOW means "ysoyzdhw6f" equal "0"
|
HELP!!
Last edited by stingtao on Wed May 05, 2010 10:47 pm; edited 1 time in total |
|
Back to top |
|
boots Administrator
Joined: 16 Apr 2003 Posts: 5611 Location: Toronto, Canada
|
Posted: Sun Jan 15, 2006 10:00 pm Post subject: |
|
|
Actually, that is expected. PHP is loosely typed so when you try to compare a string to an integer, it coerces the string to an int which in this case results in it being equal to 0. What you probaly want is to use the === operator.
see: http://php.net/manual/en/language.types.type-juggling.php |
|
Back to top |
|
stingtao Smarty Rookie
Joined: 15 Jan 2006 Posts: 5
|
|
Back to top |
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|