php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #10475 Array returned by str_replace unusable.
Submitted: 2001-04-24 13:06 UTC Modified: 2001-04-24 13:08 UTC
From: sbw at sbw dot org Assigned:
Status: Closed Package: *Function Specific
PHP Version: 4.0.4pl1 OS: FreeBSD
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: sbw at sbw dot org
New email:
PHP Version: OS:

 

 [2001-04-24 13:06 UTC] sbw at sbw dot org
See http://sbw.sbw.org/str_replace/.

str_replace(-string-, -string-, -array-) should return an array.

It appears that it does so, but when the returned array is passed to implode or each, PHP issues warnings:

"Bad arguments to implode()"

"Variable passed to each() is not an array or object"

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2001-04-24 13:08 UTC] andrei@php.net
It works in latest CVS.

$input = array('foobar', 'barhop');
var_dump(implode(' : ', str_replace('bar', '---', $input)));

Output:
string(15) "foo--- : ---hop"

 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Dec 26 19:01:30 2024 UTC