Voting

: min(eight, four)?
(Example: nine)

The Note You're Voting On

paule at cs dot tamu dot edu
22 years ago
After reading KoKos' post above, I thought that the code I posted right before his should do what he wanted. However, my original post neglected to note the little "Tip" in the documentation above, about a single element replacement.

If one changes the lines in my code above that says:

<?php
if(is_array($replacement))
foreach(
$replacement as $r_key=>$r_value)
$new_array[$r_key]=$r_value;
?>

to instead say:

<?php
if(is_string($replacement))
$new_array[$key]=$replacement;
elseif(
is_array($replacement))
foreach(
$replacement as $r_key=>$r_value)
$new_array[$r_key]=$r_value;
?>

that will solve the problem.

Sorry for the omission.

<< Back to user notes page

To Top