Jump to content

Manipulate String, Insert Characters


JustinK101

Recommended Posts

What is the best way to do the following string manipulation.

 

$string = "012354631556"

 

I want to add brackets after the last character, and then before the 6th to last character. So:

 

$string = "012354[631556]"

 

What is the best way to do this? Thanks.

Link to comment
https://forums.phpfreaks.com/topic/201685-manipulate-string-insert-characters/
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.