Hi! Could we please enable some services and cookies to improve your experience and our website?

PHPize Online / SQLize Online  /  SQLtest Online

A A A
Share      Blog   Popular

PHPize.online is a free online environment for quickly running, experimenting with and sharing PHP (including Carbon extension for DateTime) and SQL code. You can run your SQL code with PHP code that can use the same DB. For database manipulations you can use pre-defined instances of PDO ($pdo), mysqli ($mysqli) & Laravel query builder ($db)

Copy Format Clear
CREATE TABLE somewhere ( id INT AUTO_INCREMENT, name VARCHAR(100), PRIMARY KEY (id) ); INSERT INTO somewhere(id, name) VALUES (1, 'Chad'), (4, 'Ned'), (5, 'Dave'), (14, 'Newt'), (18, 'Bill'), (21, 'Norton'), (25, 'Alan');
Copy Clear
Copy Format Clear
<?php class test { public $name; public function __constructor(string $name) { $this->name = $name; } } $sql = <<<SQL SELECT name FROM somewhere SQL; $stmt = $pdo->prepare($sql); $stmt->execute(); var_export($stmt->fetchAll(PDO::FETCH_UNIQUE | PDO::FETCH_CLASS));
Show:  
Copy Clear