php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Doc Bug #38337 explode function's return value is incorrect
Submitted: 2006-08-04 22:04 UTC Modified: 2006-08-05 19:49 UTC
From: z_rules55 at hotmail dot com Assigned:
Status: Not a bug Package: Documentation problem
PHP Version: Irrelevant OS:
Private report: No CVE-ID: None
View Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
If you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: z_rules55 at hotmail dot com
New email:
PHP Version: OS:

 

 [2006-08-04 22:04 UTC] z_rules55 at hotmail dot com
Description:
------------
explode() is listed as returning an array. However, its documentation states that:

--------------
If separator is an empty string (""), explode() will return FALSE. If separator contains a value that is not contained in string, then explode() will return an array containing string.
--------------

The return value should therefore be "mixed".


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2006-08-05 01:59 UTC] sean@php.net
Many functions return FALSE if something goes wrong/data has been exhausted/the function does not find what the developer was looking for.

In fact, we'd have to mark a great number of functions in the manual "mixed" if we followed the convention you propose. Instead, we mark return values as the most common case(s), and avoid error situations.

See strpos(), each(), mysql_fetch_assoc(), etc.

S
 [2006-08-05 19:49 UTC] z_rules55 at hotmail dot com
My bad. I saw the part where it said "will return an array containing string" and thought that the function would return an actual string.
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Tue Aug 05 17:00:03 2025 UTC