PHPize Online / SQLize Online  /  SQLtest Online

A A A
Share      Blog   Popular
Copy Format Clear
Copy Clear
Copy Format Clear
<?php 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($db::raw("SELECT VERSION() as version;")); printf('DB version (Laravel Query Builder): %s ' . PHP_EOL, $version[0]->version); $text = "She sells sea shells on the sea shore; The shells that she sells are sea shells I'm sure. So if she sells sea shells on the sea shore, I'm sure that the shells are sea shore shells."; // $words = preg_split('/\s+/', $text); // echo $text; function countUniqueWords($text) { $words = preg_split('/\s+/', $text); $cleaned_words = array_map('trim', $words); $lowered_words = array_map('strtolower', $cleaned_words); $unique_words = array_unique($lowered_words); echo count($unique_words); return count($lowered_words); } // $input_text = trim(fgets(STDIN)); // Вывод количества уникальных слов echo countUniqueWords($text);
Show:  
Copy Clear