schme16 Posted April 18, 2007 Share Posted April 18, 2007 I'm wanting php to explode a file name that has numbers at the end...mostly I want the numbers gone...so if there's another way around it I'd love to hear it... This is what I got so far: $file_1 = explode('.',$file); //Gets rid of the .extension $file_1 = explode(int,$file_1[0]); // failed attempt at removing the numbers. Quote Link to comment https://forums.phpfreaks.com/topic/47560-solved-explodeinterger-question/ Share on other sites More sharing options...
Glyde Posted April 18, 2007 Share Posted April 18, 2007 This might work. $int = current(explode(chr(46), $file)); Quote Link to comment https://forums.phpfreaks.com/topic/47560-solved-explodeinterger-question/#findComment-232155 Share on other sites More sharing options...
schme16 Posted April 18, 2007 Author Share Posted April 18, 2007 I've found a rather ungraceful approach to it: <?php $file_1 = explode('.',$file); $file_1 = explode((0),$file_1[0]); $file_1 = explode((1),$file_1[0]); $file_1 = explode((2),$file_1[0]); $file_1 = explode((3),$file_1[0]); $file_1 = explode((1),$file_1[0]); $file_1 = explode((4),$file_1[0]); $file_1 = explode((5),$file_1[0]); $file_1 = explode((6),$file_1[0]); $file_1 = explode((7),$file_1[0]); $file_1 = explode((,$file_1[0]); $file_1 = explode((1),$file_1[0]); $file_1 = explode((9),$file_1[0]); ?> Quote Link to comment https://forums.phpfreaks.com/topic/47560-solved-explodeinterger-question/#findComment-232156 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.