php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Doc Bug #74228 Documentation for substr_replace() when 'start' is zero
Submitted: 2017-03-09 07:02 UTC Modified: 2017-03-09 11:07 UTC
From: direvus at gmail dot com Assigned: peehaa (profile)
Status: Closed Package: Documentation problem
PHP Version: Irrelevant OS:
Private report: No CVE-ID: None
 [2017-03-09 07:02 UTC] direvus at gmail dot com
Description:
------------
---
From manual page: http://www.php.net/function.substr-replace
---

The description of the 'start' argument says:

"""
    If start is positive, the replacing will begin at the start'th offset into string.

    If start is negative, the replacing will begin at the start'th character from the end of string.
"""

This fails to account for the case where 'start' is zero.  Instead of "positive", it should say "non-negative", or "positive or zero", or "greater than or equal to zero".


Test script:
---------------
print substr_replace('bar', 'foo', 0);


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2017-03-09 11:05 UTC] peehaa@php.net
-Assigned To: +Assigned To: peehaa
 [2017-03-09 11:07 UTC] peehaa@php.net
-Status: Assigned +Status: Closed
 [2017-03-09 11:07 UTC] peehaa@php.net
This bug has been fixed in the documentation's XML sources. Since the
online and downloadable versions of the documentation need some time
to get updated, we would like to ask you to be a bit patient.

Thank you for the report, and for helping us make our documentation better.


 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Sat Mar 15 19:01:30 2025 UTC