phpnewbie112 Posted September 9, 2008 Share Posted September 9, 2008 Hello, could you pls advice how can I count the first 2 numbers for ex: 19233659536 I want a rule like If (first 2 == 19) { do the rule } Thanks Link to comment https://forums.phpfreaks.com/topic/123397-solved-counting-first-2-left-numbers/ Share on other sites More sharing options...
redarrow Posted September 9, 2008 Share Posted September 9, 2008 example........ <?php $num=19234455677654; $x=substr($num,0,2); if($x=="19"){ echo"the numbers of $num has number $x at the beging "; }else{ echo wrong ; } ?> short way <?php $num=19234455677654; if(substr($num,0,2)=="19"){ echo"the numbers of $num has number $x at the beging "; }else{ echo wrong ; } ?> Link to comment https://forums.phpfreaks.com/topic/123397-solved-counting-first-2-left-numbers/#findComment-637330 Share on other sites More sharing options...
phpnewbie112 Posted September 9, 2008 Author Share Posted September 9, 2008 Thanks Link to comment https://forums.phpfreaks.com/topic/123397-solved-counting-first-2-left-numbers/#findComment-637376 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.