phpretard Posted October 30, 2010 Share Posted October 30, 2010 I have a list of pictures and I want to control the order. Here is the picture format: $pic = http://www.picture.biz/incoming/w_2GTEK13T961240561_1.jpg $pic = http://www.picture.biz/incoming/w_2GTEK13T961240561_2.jpg $pic = http://www.picture.biz/incoming/w_2GTEK13T961240561_3.jpg $pic = http://www.picture.biz/incoming/w_2GTEK13T961240561_4.jpg $pic = http://www.picture.biz/incoming/w_2GTEK13T961240561_5.jpg Notice the order 1.jpg, 2.jpg, etc.. Here is where I'm stuck... // begin stuck $orderPic = explode("_", $pic); foreach($orderPic as $rank){ echo "$rank"; // I need $rank to equal 1 then 2 then 3 ... } It would be nice actually if I could start the insert with number 2 because number one is always a screwy picture. I hope this makes sense / Thank for the help! Link to comment https://forums.phpfreaks.com/topic/217295-need-to-parse-one-char-from-string-and-assign-it-as-a-var/ Share on other sites More sharing options...
phpretard Posted October 30, 2010 Author Share Posted October 30, 2010 I forgot the above yeilds this: http://www.picture.biz/incoming/w 2GTEK13T961240561 1.jpg <<<<< --- I want the number one from this Link to comment https://forums.phpfreaks.com/topic/217295-need-to-parse-one-char-from-string-and-assign-it-as-a-var/#findComment-1128355 Share on other sites More sharing options...
revraz Posted October 30, 2010 Share Posted October 30, 2010 So you basically just want everything after the underscore? Explode it. http://php.net/manual/en/function.explode.php Link to comment https://forums.phpfreaks.com/topic/217295-need-to-parse-one-char-from-string-and-assign-it-as-a-var/#findComment-1128356 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.