Jump to content

Capturing first 6 characters in a string


Rottingham

Recommended Posts

Ok So I want the pro way to do this.

 

I have a string that I just want to pick the first six characters out. My string looks like

 

CEE500 - Open

 

I just want the CEE500. Now I know this is like 'duh'... But, I've tried split ('-', $string) and it returns the whole string, I've tried preg_split('/ /', $string) and I get the whole string.

 

I could do $string=$string[0].$string[1]...$string[5] but that' a lousy way...

 

Any suggestion?

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.