Jump to content

Need to parse one char from string and assign it as a $var


phpretard

Recommended Posts

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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.