Hi! Could we please enable some services and cookies to improve your experience and our website?

PHPize | SQLize | SQLtest

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

A A A
Login    Share code      Blog   FAQ
Copy Format Clear
CREATE TABLE A ( DATA VARCHAR(10) NOT NULL ); INSERT INTO A ( DATA ) VALUES ('a'); INSERT INTO A ( DATA ) VALUES ('b'); SELECT * FROM A;

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

Copy Clear
Copy Format Clear
<?php use Carbon\Carbon; $iteration = 0; $custom_conn_timeout_seconds = [1, 5, 10]; $timeout_count = is_array($custom_conn_timeout_seconds) ? count($custom_conn_timeout_seconds) : 1; $max_iteration = max(2, $timeout_count); $endpoint = 'abc.com'; while ($iteration < $max_iteration) { // # iterate to next connection timeout duration $request_arr['timeout'] = $custom_conn_timeout_seconds[min($iteration, $timeout_count)]; $iteration++; try { //$__conn_response = $__conn->request($this->method, $endpoint, $request_arr); $a = 1/0; break; } catch (DivisionByZeroError $e) { // ! Detect Server Error if (false) { continue; } break; } catch (ErrorException $e) { // ! Detect Connection Timeout break; } } echo '<pre>'; print_r($iteration);
Copy Clear