Jump to content

[SOLVED] split string into array by string position - not delimiter?


Anti-Moronic

Recommended Posts

What I want to do is split a string by the string position, like so:

 

string position: 4

 

$str = "123|321|123";

 

what I want to output is 2 strings into an array:

 

array('123|', '321|123');

 

Any help is greatly appreciated. thanks.

Can't use explode on this. That would remove the | and split the string into 3:

 

array('123', '321', '123');

 

Thanks anyway. Maybe there is a way to do it with explode, but I can't reply on a character, I need to rely on an actual position within the array.

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.