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
Login    Share code      Blog   FAQ

Online Sandbox for SQL and PHP: Write, Run, Test, and Share SQL Queries and PHP Code

Copy Format Clear
create table users(name text, family text[]); INSERT INTO users(name, family) VALUES ('Ivan', '{"Mom", "Father"}'::text[]); INSERT INTO users(name, family) VALUES ('Ivan', '{"Mom", "Father"}'); INSERT INTO users(name, family) VALUES('Ivan', ARRAY(["Mom", "Father"])); select name, unnest(family) from users;

Stuck with a problem? Got Error? Ask AI support!

Copy Clear
Copy Format Clear
<?php $stmt = $pdo->prepare("select species, count(species) quantity from penguins group by species order by species desc;"); $stmt->execute(); $rows1 = $stmt->fetchAll(PDO::FETCH_NUM); $stmt = $pdo->prepare("select species, count(species) quantity from penguins group by species order by species asc;"); $stmt->execute(); $rows2 = $stmt->fetchAll(PDO::FETCH_NUM); //var_export($rows1); //var_export($rows2); sort($rows1); sort($rows2); foreach($rows1 as $i=>$r) { var_export($r); var_export($rows2[$i]); var_export($r === $rows2[$i]); }
Copy Clear