spires Posted December 16, 2008 Share Posted December 16, 2008 Hi guys, for some reason I can't get ! to work. if (!$var_mobile_number[1] == '7'){ echo 'yes'; }else{ echo 'no'; } I want it so if $var_mobile_number[1] is not == to 7 then echo yes. But this does not seem to work. Any ideas? Thanks Link to comment https://forums.phpfreaks.com/topic/137171-solved-not-working/ Share on other sites More sharing options...
beansandsausages Posted December 16, 2008 Share Posted December 16, 2008 Hi guys, for some reason I can't get ! to work. if (!$var_mobile_number[1] == '7'){ echo 'yes'; }else{ echo 'no'; } I want it so if $var_mobile_number[1] is not == to 7 then echo yes. But this does not seem to work. Any ideas? Thanks May need a bit more code. Link to comment https://forums.phpfreaks.com/topic/137171-solved-not-working/#findComment-716546 Share on other sites More sharing options...
gevans Posted December 16, 2008 Share Posted December 16, 2008 if ($var_mobile_number[1] != '7'){ echo 'yes'; }else{ echo 'no'; } Link to comment https://forums.phpfreaks.com/topic/137171-solved-not-working/#findComment-716547 Share on other sites More sharing options...
Adam Posted December 16, 2008 Share Posted December 16, 2008 Perhaps: if ($var_mobile_number{1} != '7'){ echo 'yes'; }else{ echo 'no'; } Link to comment https://forums.phpfreaks.com/topic/137171-solved-not-working/#findComment-716548 Share on other sites More sharing options...
beansandsausages Posted December 16, 2008 Share Posted December 16, 2008 is var $var_mobile_numbr[1] even = 7 ? Link to comment https://forums.phpfreaks.com/topic/137171-solved-not-working/#findComment-716549 Share on other sites More sharing options...
spires Posted December 16, 2008 Author Share Posted December 16, 2008 Thats excellent gevans I new it had to be something like that. Cheers Link to comment https://forums.phpfreaks.com/topic/137171-solved-not-working/#findComment-716550 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.