From:             robert_xp at gmx dot net
Operating system: 
PHP version:      5.3.1
PHP Bug Type:     Feature/Change Request
Bug description:  str_split sequence handling

Description:
------------
str_split is only able to split a string in periodical substrings. I
think, it's a good improvement to allow arrays as a second parameter to
handle sequences. I wrote a patch for that:
http://www.xarg.org/2009/12/php-hacking/

Reproduce code:
---------------
var_dump(str_split("0123456789abcdefwant to extract this?abcd", array(16,
-4)));

var_dump(str_split("hello how are you?", array(0, 1, 6, 7, 9, -2, -1)));


Expected result:
----------------
array(3) {
  [0]=>
  string(16) "0123456789abcdef"
  [1]=>
  string(21) "want to extract this?"
  [2]=>
  string(4) "abcd"
}
array(7) {
  [0]=>
  string(1) "h"
  [1]=>
  string(5) "ello "
  [2]=>
  string(1) "h"
  [3]=>
  string(2) "ow"
  [4]=>
  string(7) " are yo"
  [5]=>
  string(1) "u"
  [6]=>
  string(1) "?"
}



-- 
Edit bug report at http://bugs.php.net/?id=50653&edit=1
-- 
Try a snapshot (PHP 5.2):            
http://bugs.php.net/fix.php?id=50653&r=trysnapshot52
Try a snapshot (PHP 5.3):            
http://bugs.php.net/fix.php?id=50653&r=trysnapshot53
Try a snapshot (PHP 6.0):            
http://bugs.php.net/fix.php?id=50653&r=trysnapshot60
Fixed in SVN:                        
http://bugs.php.net/fix.php?id=50653&r=fixed
Fixed in SVN and need be documented: 
http://bugs.php.net/fix.php?id=50653&r=needdocs
Fixed in release:                    
http://bugs.php.net/fix.php?id=50653&r=alreadyfixed
Need backtrace:                      
http://bugs.php.net/fix.php?id=50653&r=needtrace
Need Reproduce Script:               
http://bugs.php.net/fix.php?id=50653&r=needscript
Try newer version:                   
http://bugs.php.net/fix.php?id=50653&r=oldversion
Not developer issue:                 
http://bugs.php.net/fix.php?id=50653&r=support
Expected behavior:                   
http://bugs.php.net/fix.php?id=50653&r=notwrong
Not enough info:                     
http://bugs.php.net/fix.php?id=50653&r=notenoughinfo
Submitted twice:                     
http://bugs.php.net/fix.php?id=50653&r=submittedtwice
register_globals:                    
http://bugs.php.net/fix.php?id=50653&r=globals
PHP 4 support discontinued:          http://bugs.php.net/fix.php?id=50653&r=php4
Daylight Savings:                    http://bugs.php.net/fix.php?id=50653&r=dst
IIS Stability:                       
http://bugs.php.net/fix.php?id=50653&r=isapi
Install GNU Sed:                     
http://bugs.php.net/fix.php?id=50653&r=gnused
Floating point limitations:          
http://bugs.php.net/fix.php?id=50653&r=float
No Zend Extensions:                  
http://bugs.php.net/fix.php?id=50653&r=nozend
MySQL Configuration Error:           
http://bugs.php.net/fix.php?id=50653&r=mysqlcfg

Reply via email to