Exponential 6.0.13 Exponential Enterprise Open Source CMS - PHP Class Reference

ezstringutils.php
Go to the documentation of this file.
1 <?php
17 class eZStringUtils
18 {
19 static function explodeStr( $str, $delimiter = '|' )
20 {
21 $offset = 0;
22 $array = array();
23
24 while( ( $pos = strpos( $str, $delimiter, $offset ) ) !== false )
25 {
26 $strPart = substr( $str, 0, $pos );
27 if ( preg_match( '/(\\\\+)$/', $strPart, $matches ) )
28 {
29 if ( strlen( $matches[0] ) % 2 !== 0 )
30 {
31 $offset = $pos+1;
32 continue;
33 }
34 }
35 $array[] = str_replace( '\\\\', '\\', str_replace("\\$delimiter", $delimiter, $strPart ) );
36 $str = substr( $str, $pos + 1 );
37 $offset = 0;
38
39 }
40 $array[] = str_replace( '\\\\', '\\', str_replace("\\$delimiter", $delimiter, $str ) );
41 return $array;
42 }
43
44 static function implodeStr( $values, $delimiter = '|' )
45 {
46 $str = '';
47 foreach ( $values as $key => $value )
48 {
49 $values[$key] = str_replace( $delimiter, "\\$delimiter", str_replace( '\\', '\\\\', $value ) );
50 }
51 return implode( $delimiter, $values );
52 }
53
54
55 }
56
57 ?>
eZStringUtils
The class eZStringUtils does.
Definition: ezstringutils.php:18
eZStringUtils\implodeStr
static implodeStr( $values, $delimiter='|')
Definition: ezstringutils.php:44
eZStringUtils\explodeStr
static explodeStr( $str, $delimiter='|')
Definition: ezstringutils.php:19
Copyright © 1998 – 2026 7x. All rights reserved. Licensed under the GNU GPLv2+.