Código PHP:
Ver originalclass Filter {
private $filtros = [];
function __construct($cadena) {
foreach (explode('&', $cadena) as $par) { $this->filtros[$filtro] = is_numeric($valor) ?
$valor : "'$valor'"; }
}
function __get($filtro) {
return $this->filtros[$filtro];
}
}
$filtros = new Filter("select_time=tiempo&grade=3&genre=5&language=spanish");
echo "SELECT * FROM tblmovies WHERE "
. "grade = $filtros->grade AND "
. "genre = $filtros->genre AND "
. "language = $filtros->language AND "
. "select_time = $filtros->select_time;";