Jump to content

Use string before end 32 characters?


oni-kun

Recommended Posts

I have a hash that is 32 characters long, it's concatenated after another string which is of variable length. How do I extract anything before the end 32 characters? "$string . md5(...);" is what I have to give a clearer picture. I've tried everything with string manipulation and couldn't find a fully working method.. I can't find what just $string is.

Link to comment
Share on other sites

Considering the last 32 characters of the string is the hash and you want to remove it use this:

 

$string = substr($string, 0, -32);

 

If you want to remove everything except the hash use this

 

$string = substr($string, -32);

 

Again both is dependent on the 32 digit long hash being on the end of the string as you stated.

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.