Forum Moderators: coopster

Message Too Old, No Replies

Explode function without convert option

         

toplisek

11:35 am on Oct 5, 2015 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



$mystring = explode("|", mb_strtolower($data, 'UTF-8'));

I have defined explode function but how to explode without convert option mb_strtolower and just explode strings in encoding mode?

Need help.

whitespace

11:59 am on Oct 5, 2015 (gmt 0)

10+ Year Member Top Contributors Of The Month



You could try mb_split() [php.net] ...?


mb_internal_encoding('UTF-8');
mb_regex_encoding('UTF-8');

$myArray = mb_split('|', $data);

toplisek

3:01 pm on Oct 5, 2015 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



I had to use
$myvar = explode("|", $data);

It seems it will not work mb_split.
How to add UTF-8 encoding to this option?
You have used
mb_internal_encoding('UTF-8');
mb_regex_encoding('UTF-8');
Is this still the same or better option?

whitespace

1:28 pm on Oct 6, 2015 (gmt 0)

10+ Year Member Top Contributors Of The Month



I'm not sure to be honest. The problem with explode() is that it works on bytes. If $data is a multi-byte string (which it would seem to be from your initial code snippet) then it might break.