From db6c4af2716bdf984de450821eca75bfc134395d Mon Sep 17 00:00:00 2001 From: Brion Vibber Date: Mon, 15 Nov 2004 00:15:58 +0000 Subject: [PATCH] Spiff this up a bit: * output data returned by the eval; prints strings and numbers directly, var_dump()s arrays and objects * if no returned data, print a line break. This makes things easier when doing 'echo' and you forget to add one yourself. * Add some documentation comments --- maintenance/eval.php | 25 ++++++++++++++++++++----- 1 file changed, 20 insertions(+), 5 deletions(-) diff --git a/maintenance/eval.php b/maintenance/eval.php index c53da36f90..9ef4958fbf 100755 --- a/maintenance/eval.php +++ b/maintenance/eval.php @@ -1,6 +1,17 @@ " ); - eval( $line . ";" ); + $val = eval( $line . ";" ); + if( is_null( $val ) ) { + echo "\n"; + } elseif( is_string( $val ) || is_numeric( $val ) ) { + echo "$val\n"; + } else { + var_dump( $val ); + } if ( function_exists( "readline_add_history" ) ) { readline_add_history( $line ); } } while ( 1 ); - - - ?> -- 2.20.1