3v4l.org

run code in 300+ PHP versions simultaneously
<?php $_GET['user_id'] = 3; $query[] = "select * from preferences user_id = "; $query[] = $_GET['user_id']; db_exec($query); function db_exec(string|array $query_parts) { if (is_string($query_parts) && !is_literal($query_parts)) { throw new \Exception("Cannot use non literal string as query. Please pass the parts in as an array"); } else { foreach ($query_parts as $query_part) { if (is_string($query_part) && !is_literal($query_part)) { throw new \Exception("non-literal string found [$query_part]"); } else if (is_int($query_part)) { // todo - decide if you want to allow this or not. // I personally wouldn't. } else { // todo - support other types } } var_dump(implode("", $query_parts)); } // rest of db_exec here... }
Output for git.master, git.master_jit, rfc.property-hooks
Fatal error: Uncaught Error: Call to undefined function is_literal() in /in/aCFIT:17 Stack trace: #0 /in/aCFIT(8): db_exec(Array) #1 {main} thrown in /in/aCFIT on line 17
Process exited with code 255.

This tab shows result from various feature-branches currently under review by the php developers. Contact me to have additional branches featured.

Active branches

Archived branches

Once feature-branches are merged or declined, they are no longer available. Their functionality (when merged) can be viewed from the main output page


preferences:
66.53 ms | 401 KiB | 8 Q