sepoto Posted November 2, 2010 Share Posted November 2, 2010 My strrpos function is having a very hard time locating my ','. EasyPHP installed on Windows7. It finds the third instance of the comma but not the first. Does anyone know why the strrpos function blows past three ',' charachters before it finds me a comma?<?php$start=0;$pos=0;while($pos=strrpos($book,",",$start)){ $entry=substr($book,$start,$pos); $start=$pos+1; echo $entry; }?>Thanks!Eric Link to comment Share on other sites More sharing options...
jeffman Posted November 2, 2010 Share Posted November 2, 2010 Do you mean to be using strpos instead of strrpos? Link to comment Share on other sites More sharing options...
Fmdpa Posted November 2, 2010 Share Posted November 2, 2010 I've made this confusing mistake before too. strrpos() finds the last occurrence of the specified character. strpos() finds the first occurrence. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.