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); $input = 'dg24dmdtws.er.usgs.gov [30:13:43:08] "GET /icons/ok2-0.gif HTTP/1.0" 200 231'; /*preg_match('~"(.*?)"~', $input, $output); echo $output[1]; // 256 $input = str_replace("$output[1]", '', $input); echo "\n"; echo $input; echo "\n"; $output = explode( '"', $input); $array = explode(" ", $output[2]); echo $array[1]; echo "\n"; echo $array[2]; echo "\n";*/ $input ='isis.msstate.edu [30:08:39:54] "GET /docs/GCDOAR/landfill.html" 200 10788'; preg_match('~"(.*?)"~', $input, $request); var_dump($request[1]); $logEntry = str_replace(' "'.$request[1].'"', '', $input); $logData = explode(" ", str_replace(["[", "]"], '', $logEntry)); var_dump($logData);
Show:  
Copy Clear