PHPize Online / SQLize Online  /  SQLtest Online

A A A
Share      Blog   Popular
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;
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);
Show:  
Copy Clear