update page now

Voting

: min(two, six)?
(Example: nine)

The Note You're Voting On

ravenswd at gmail dot com
7 years ago
This is what happens when the search and replace arrays are different sizes:

<?php
$search  = array('a', 'b', 'c', 'd', 'e');
$replace = array('A', 'B', 'C');
$subject = 'abcdefg';
echo str_replace($search, $replace, $subject);
// result: 'ABCfg'

$search  = array('a', 'b', 'c');
$replace = array('A', 'B', 'C', 'D', 'E');
$subject = 'abcdefg';
echo str_replace($search, $replace, $subject);
// result: 'ABCdefg'
?>

No warning or error is generated in either of these cases.

<< Back to user notes page

To Top