- var_dump: documentation ( source)
- addslashes: documentation ( source)
- array_shift: documentation ( source)
- implode: documentation ( source)
- array_walk: documentation ( source)
- sprintf: documentation ( source)
<?php
function mysqli_real_escape_string($a) { return addslashes($a); }
function callStoredProc( $storedProc )
{
$args = func_get_args();
$storedProc = array_shift( $args );
array_walk( $args, function( &$item, $key ) {
$item = "'" . addslashes( $arg ) . "'";
});
$procCall = sprintf( 'call %s( %s )', $storedProc, implode( ',', $args ) );
var_dump( $procCall );
}
callStoredProc( 'something', 1, 'a', 'b\'' );