309309 <div class="php8-code phpcode">
310310 <?php highlight_php_trimmed (
311311 <<<'PHP'
312- // TODO
312+ $sh = curl_share_init();
313+ curl_share_setopt($sh, CURLSHOPT_SHARE, CURL_LOCK_DATA_DNS);
314+ curl_share_setopt($sh, CURLSHOPT_SHARE, CURL_LOCK_DATA_CONNECT);
315+
316+ $ch1 = curl_init('https://php.net/');
317+ curl_setopt($ch1, CURLOPT_SHARE, $sh);
318+ curl_exec($ch1);
319+
320+ $ch2 = curl_init('https://thephp.foundation/');
321+ curl_setopt($ch2, CURLOPT_SHARE, $sh);
322+ curl_exec($ch2);
323+
324+ curl_share_close($sh);
325+
326+ curl_close($ch1);
327+ curl_close($ch2);
313328PHP
314329
315330 ); ?>
321336 <div class="php8-code phpcode" style="display: table-cell;">
322337 <?php highlight_php_trimmed (
323338 <<<'PHP'
324- // TODO
339+ $sh = curl_share_init_persistent([
340+ CURL_LOCK_DATA_DNS,
341+ CURL_LOCK_DATA_CONNECT
342+ ]);
343+
344+ $ch1 = curl_init('https://php.net/');
345+ curl_setopt($ch1, CURLOPT_SHARE, $sh);
346+ curl_exec($ch1);
347+
348+ $ch2 = curl_init('https://thephp.foundation/');
349+ curl_setopt($ch2, CURLOPT_SHARE, $sh);
350+ curl_exec($ch2);
351+
352+ curl_close($ch1);
353+ curl_close($ch2);
325354PHP
326355 ); ?>
327356 </div>
@@ -343,10 +372,22 @@ PHP
343372 <div class="php8-code phpcode">
344373 <?php highlight_php_trimmed (
345374 <<<'PHP'
346- $versions = ['PHP 8.1', 'PHP 8.2', 'PHP 8.3', 'PHP 8.4', 'PHP 8.5'];
375+ $php = [
376+ 'php-82' => ['state' => 'security', 'branch' => 'PHP-8.2'],
377+ 'php-83' => ['state' => 'active', 'branch' => 'PHP-8.3'],
378+ 'php-84' => ['state' => 'active', 'branch' => 'PHP-8.4'],
379+ 'php-85' => ['state' => 'upcoming', 'branch' => 'PHP-8.5'],
380+ ];
381+
382+ $upcomingRelease = null;
383+ foreach ($php as $key => $version) {
384+ if ($version['state'] === 'upcoming') {
385+ $upcomingRelease = $version;
386+ break;
387+ }
388+ }
347389
348- var_dump($versions[array_key_first($versions)]);
349- // string(7) "PHP 8.1"
390+ var_dump($upcomingRelease);
350391PHP
351392
352393 ); ?>
@@ -358,10 +399,21 @@ PHP
358399 <div class="php8-code phpcode" style="display: table-cell;">
359400 <?php highlight_php_trimmed (
360401 <<<'PHP'
361- $versions = ['PHP 8.1', 'PHP 8.2', 'PHP 8.3', 'PHP 8.4', 'PHP 8.5'];
402+ $php = [
403+ 'php-82' => ['state' => 'security', 'branch' => 'PHP-8.2'],
404+ 'php-83' => ['state' => 'active', 'branch' => 'PHP-8.3'],
405+ 'php-84' => ['state' => 'active', 'branch' => 'PHP-8.4'],
406+ 'php-85' => ['state' => 'upcoming', 'branch' => 'PHP-8.5'],
407+ ];
408+
409+ $upcomingRelease = array_first(
410+ array_filter(
411+ $php,
412+ static fn($version) => $version['state'] === 'upcoming'
413+ )
414+ );
362415
363- var_dump(array_first($versions));
364- // string(7) "PHP 8.1"
416+ var_dump($upcomingRelease);
365417PHP
366418 ); ?>
367419 </div>
0 commit comments