- Decimal type / Decimal math by default (as opposed to floats)
- Related internals threads:
- Null-safe cast operations
- Generics
- "Interface" for callables / closures
This is a guide to setting up Jenkins for PHP projects. The Jenkins plugins required are linked in each section below.
Be sure to check the pipeline step reference link on the plugin pages linked below for full documentation and options for Jenkinsfile.
This guide uses Jenkinsfile based pipelines and assumes you already have a basic Jenkinsfile.
This guide assumes that you already have each of the tools mentioned configured for use outside of Jenkins. Only the necessary configuration options for working with Jenkins are mentioned.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
ini_set('memory_limit', '2M'); | |
function shutdownHandler() | |
{ | |
print "Shutdown handler triggered\n"; | |
print "Memory limit: ". ini_get('memory_limit') ."\n"; | |
// If the next line is commented, a second OOM will be triggered | |
ini_set('memory_limit', '-1'); | |
print "Memory limit: ". ini_get('memory_limit') ."\n"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class DateTimeFactory | |
{ | |
public static function createImmutableFromFormat(string $format, string $time, \DateTimeZone $timezone = null) : \DateTimeImmutable | |
{ | |
$dt = \DateTimeImmutable::createFromFormat($format, $time, $timezone); | |
// DateTime errors/warnings can occur even if the object was successfully created (eg. invalid date) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.IssueLabel { | |
border-radius: 3px !important; | |
padding: 0 3px !important; | |
} | |
.UnderlineNav { | |
justify-content: center; | |
} | |
.UnderlineNav-item { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public function fatalMemory() : void | |
{ | |
$a = ''; | |
while (true) { | |
$a .= str_repeat("Hello", 1024 * 1024); | |
} | |
} | |
public function timeout() : void |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
declare(strict_types=1); | |
// Prometheus metrics exporter for PHP-FPM | |
header("Content-Type: text/plain; version=0.0.4"); | |
$stats = null; | |
$protocol = ((!empty($_SERVER["HTTPS"]) && $_SERVER["HTTPS"] !== "off") ? "https" : "http"); | |
$result = file_get_contents($protocol ."://" . $_SERVER["SERVER_NAME"] . "/php-fpm-status?json&full"); | |
if ($result !== false) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// https://3v4l.org/e79nG | |
$arr1 = [1, 2, 3]; | |
$arr2 = [2, 4, 1]; | |
$arr1 += $arr2; | |
var_dump($arr1); | |
$arr1 = ["foo", "bar", "baz"]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
use Bunny\Channel; | |
use Bunny\Async\Client; | |
use Bunny\Message; | |
use Bunny\Protocol\MethodBasicConsumeOkFrame; | |
use React\EventLoop\Factory; | |
require '../../vendor/autoload.php'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SELECT table1.employee_id_1, table1.employee_id_2, e1.first_name AS e1_first_name, e2.first_name AS e2_first_name | |
FROM table1 | |
LEFT JOIN employee_tbl AS e1 ON table1.employee_id_1 = e1.employee_id | |
LEFT JOIN employee_tbl AS e2 ON table2.employee_id_2 = e2.employee_id |
NewerOlder