public static function render($query, array $bindings=[], $quoteChar="'")
    {

        if (!$bindings) {
            return "$query";
        }

        $keys = [];
        $values = [];

        # build a regular expression for each parameter
        foreach ($bindings as $key=>$value) {
            $keys[] = is_string($key) ? '/:'.$key.'/' : '/[?]/';
            $values[] = is_numeric($value) ? (int)$value : "$quoteChar$value$quoteChar";
        }

        $count=0;

        return preg_replace($keys, $values, "$query", 1, $count);

    }
public static function render($query, array $bindings=[], $quoteChar="'")
    {

        if (!$bindings) {
            return "$query";
        }

        $keys = [];
        $values = [];

        # build a regular expression for each parameter
        foreach ($bindings as $key=>$value) {
            $keys[] = is_string($key) ? '/:'.$key.'/' : '/[?]/';
            $values[] = is_numeric($value) ? (int)$value : "$quoteChar$value$quoteChar";
        }

        $count=0;

        return preg_replace($keys, $values, "$query", 1, $count);

    }
public static function render ( $ query , array $ bindings = [ ] , $ quoteChar = "'" ) { if ( ! $ bindings ) { return "$query" ; } $ keys = [ ] ; $ values = [ ] ; # build a regular expression for each parameter foreach ( $ bindings as $ key => $ value ) { $ keys [ ] = is_string ( $ key ) ? '/:' . $ key . '/' : '/[?]/' ; $ values [ ] = is_numeric ( $ value ) ? ( int ) $ value : "$quoteChar$value$quoteChar" ; } $ count = 0 ; return preg_replace ( $ keys , $ values , "$query" , 1 , $ count ) ; }
Try to build a readable sql query of a prepared one.

@param string $query
@param array  $bindings
@param string $quoteChar (default:')

@return string
Try to build a readable sql query of a prepared one .