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
https://forums.phpfreaks.com/topic/184221-use-string-before-end-32-characters/
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.

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.