Jump to content

Removing characters


whelpton

Recommended Posts

Last question for the week now. Almost finished.

 

All I need to do is:

 

Remove characters from the beginning and the end of a string.

 

Essentially:

 

a:4:{s:4:"full";s:111:"http://www.mothernatureinc.co.uk/wp-content/uploads/2011/02/166637_482678026567_509616567_6394964_6868412_n.jpg";i:96;s:117:"http://www.mothernatureinc.co.uk/wp-content/uploads/2011/02/166637_482678026567_509616567_6394964_6868412_n-96x96.jpg";i:60;s:117:"http://www.mothernatureinc.co.uk/wp-content/uploads/2011/02/166637_482678026567_509616567_6394964_6868412_n-60x60.jpg";i:32;s:117:"http://www.mothernatureinc.co.uk/wp-content/uploads/2011/02/166637_482678026567_509616567_6394964_6868412_n-32x32.jpg";}

 

Needs to become

 

http://www.mothernatureinc.co.uk/wp-content/uploads/2011/02/166637_482678026567_509616567_6394964_6868412_n.jpg

 

Any ideas?

 

Link to comment
Share on other sites

Easier to just use it how it is meant:

 

$s = 'a:4:{s:4:"full";s:111:"http://www.mothernatureinc.co.uk/wp-content/uploads/2011/02/166637_482678026567_509616567_6394964_6868412_n.jpg";i:96;s:117:"http://www.mothernatureinc.co.uk/wp-content/uploads/2011/02/166637_482678026567_509616567_6394964_6868412_n-96x96.jpg";i:60;s:117:"http://www.mothernatureinc.co.uk/wp-content/uploads/2011/02/166637_482678026567_509616567_6394964_6868412_n-60x60.jpg";i:32;s:117:"http://www.mothernatureinc.co.uk/wp-content/uploads/2011/02/166637_482678026567_509616567_6394964_6868412_n-32x32.jpg";}';
$a = unserialize($s);

$result = $a['full'];

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.