php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #20754 PROBLEM WITH SPLIT FUNCTION
Submitted: 2002-12-01 20:36 UTC Modified: 2002-12-01 21:16 UTC
From: ahhsee at ntu dot edu dot sg Assigned:
Status: Not a bug Package: Strings related
PHP Version: 4.2.3 OS: Win 2k
Private report: No CVE-ID: None
 [2002-12-01 20:36 UTC] ahhsee at ntu dot edu dot sg
I was trying to split the string with the splitter "\", but it gives me this error message: 
"Warning: REG_EESCAPE:wtrailing backslash (\) in E:\Inetpub\wwwroot\test\split.php on line 8"

MY SCRIPT: 

$mytest  =  "STAFF\Tester";
$arr = split ("\\", $mytest);  //--> ERROR!

Please help!


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2002-12-01 20:56 UTC] sniper@php.net
Your regex is broken, it should be:

$arr = split ("\\\\", $mytest);
 [2002-12-01 21:06 UTC] ahhsee at ntu dot edu dot sg
sorry, didnt know i have to put 2 escape characters for a for both escape character \ and search character '\'.

thanks :)
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Apr 26 21:01:29 2024 UTC