php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #1367 split() not functioning properly with periods
Submitted: 1999-05-01 22:51 UTC Modified: 1999-05-01 22:57 UTC
From: ccrider at whiterose dot net Assigned:
Status: Closed Package: Misbehaving function
PHP Version: 3.0.7 OS: FreeBSD 3.1
Private report: No CVE-ID: None
 [1999-05-01 22:51 UTC] ccrider at whiterose dot net
when calling the web page, use a GET variable named cat like this:

http://some.host.com/foobarbaz.php3?1.2.3.4.5

this is the php:

        $array = split("." , $cat , 10);

        while(list($key,$val) = each($array))
        {
                echo "$key -- $val <br>";
        }


If I use dashes it works, if I use colons it works, I have not tried many other puncuation marks, so i am not
sure if the problem is specific to the period, or specific to the GET vars and periods.

Thank You.

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [1999-05-01 22:57 UTC] jim at cvs dot php dot net
"." means "any character" in a regular expression.

Either use explode(), which doesn't use regular expressions,
or use "\\." to escape the period
 
PHP Copyright © 2001-2026 The PHP Group
All rights reserved.
Last updated: Sun Oct 11 02:00:01 2026 UTC