maxudaskin Posted May 10, 2008 Share Posted May 10, 2008 I have a (portion of) a script below, the input would be, lets say 20082407. It echos 2008.24. and not the last 2 numbers... any ideas? <?php $start = substr($row['start'],0,4) . "." . substr($row['start'],5,6) . "." . substr($row['start'],7,; echo $start; ?> Link to comment https://forums.phpfreaks.com/topic/104971-mysql-string-using-substr/ Share on other sites More sharing options...
NorthWestSimulations Posted May 10, 2008 Share Posted May 10, 2008 if worst comes to worse you can always just do echo $start[0] . $start[1] . $start[2] . $start[3] . "." . $start[4] . $start[5] . "." . $start[6] . $start[7]; Link to comment https://forums.phpfreaks.com/topic/104971-mysql-string-using-substr/#findComment-537328 Share on other sites More sharing options...
maxudaskin Posted May 10, 2008 Author Share Posted May 10, 2008 Well... I feel dumb... I used it like this: substr(string,start_char,end_char) instead of substr(string,star_char,num_of_chars) Link to comment https://forums.phpfreaks.com/topic/104971-mysql-string-using-substr/#findComment-537335 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.