Jump to content

[SOLVED] Splitting


rhyspaterson

Recommended Posts

Hey guys,

 

Been having a look a split and preg_split, and i was just wondering how would would get the last character of a string with no spaces, no matter how long the string is..? I.e -

 

thisismyreallylongstringabc

 

How would we get the last character ('c') ? I mean you could use:

 

preg_split('//', $string, -1, PREG_SPLIT_NO_EMPTY);

 

but that would put each character into an array which is a bit of overkill if all we want is the last character.. any suggestions?

 

Thanks,

/Rhys

Link to comment
https://forums.phpfreaks.com/topic/53626-solved-splitting/
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.