PHPize Online / SQLize Online  /  SQLtest Online

A A A
Share      Blog   Popular
Copy Format Clear
Copy Clear
Copy Format Clear
<?php use Carbon\Carbon; $created_at = '2024-02-23 17:01:32'; $date_till = '2024-01-07 23:59:59'; $type = 'week'; $time = new Carbon($created_at); $number = 'Y'; $number2 = 'W2'; printf("\n"); $date = new Carbon($created_at); $period = 'week'; $qty = 2; echo $date; printf("\n\n"); switch ($period) { case 'year': echo $date->addYear($qty - 1)->endOfYear(); // -1 day case 'quarter': echo $date->addQuarter($qty - 1)->endOfQuarter(); case 'month': echo $date->addMonth($qty - 1)->endOfMonth(); // -1 day case 'week': echo strtoupper($period[0]) . ceil($date->week() / $qty); printf("\n"); $number = ceil($date->week() / $qty); echo $date->startOfWeek() .', '. $date->week(); printf("\n"); while ($qty * $number > $date->week()) { $date->subWeeks(1); } echo $date->startOfWeek(); // echo $date->addWeeks($qty - 1)->endOfWeek(); } printf("\n\n"); $now = Carbon::now()->format('d/m/Y'); $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);
Show:  
Copy Clear