Jump to content

[SOLVED] How does this work?


kts

Recommended Posts

I was recently advised and helped with a code to remove the last #'s on an id. ex: 21_75_39 -> 21_75

 

the code i was presented was:

preg_replace('#_[\d]+$#', '', "21_75_8484");

 

I was wondering if someone can simply explain how it works, im not familiar with preg_replace, but i love how it worked

 

Thanks.

Link to comment
https://forums.phpfreaks.com/topic/88588-solved-how-does-this-work/
Share on other sites

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.