3v4l.org

run code in 300+ PHP versions simultaneously
<?php $fruits = [ 'apple', 'banana' , 'cherry' ]; foreach ( $fruits as $fruit ) { // The $fruit just gets overwritten each time, so the array of $fruits never changes. $fruit = str_rot13( $fruit ); } print_r( $fruits ); foreach ( $fruits as $key => $fruit ) { // Now we're assigning the rotated string back to the original array. $fruits[ $key ] = str_rot13( $fruit ); } print_r( $fruits );

preferences:
28.71 ms | 405 KiB | 5 Q