3v4l.org

run code in 300+ PHP versions simultaneously
<?php foreach ( [ false, null, [], '', '0', '0.0' ] as $value ) { $value = implode( "\n", (array) $value ); if ( $value ) { $value = str_replace( ' ', "\n", $value ); } var_dump( $value ); }
based on 5ch4t
Output for 7.3.0 - 7.3.27, 7.4.0 - 7.4.16, 8.0.0 - 8.0.3
string(0) "" string(0) "" string(0) "" string(0) "" string(1) "0" string(3) "0.0"