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

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

Copy Clear
Copy Format Clear
<?php $res = file_get_contents('http://dummyjson.com/products'); $data = json_decode($res, true)['products']; $iphoneProducts = array_filter($data, function ($item) { return strpos($item['title'], 'iPhone') !== false; }); var_dump($iphoneProducts); // use Carbon\Carbon; // $now = Carbon::now()->format('d/m/Y'); // printf("Today is %s\nCurrent PHP version: %s \n\n", $now, phpversion()); // $query = "SELECT VERSION() as version;"; // // get DB version using PDO // $stmt = $pdo->prepare($query); // $stmt->execute(); // $row = $stmt->fetch(PDO::FETCH_ASSOC); // printf('DB version (PDO): %s ' . PHP_EOL, $row['version']); // // Run query using mysqli // $result = $mysqli->query($query); // $version = $result->fetch_object(); // printf('DB version (mysqli): %s ' . PHP_EOL, $version->version); // // Select using Laravel // $version = $db::select($query); // printf('DB version (Laravel Query Builder): %s ' . PHP_EOL, $version[0]->version);
Copy Clear