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 | |
function add(float $a, float $b): float { | |
return $a + $b; | |
} |
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 | |
$data = array('foo', '', 'bar'); | |
array_walk_recursive($data, function (&$value, $key) { | |
if ($value === '') { | |
$value = null; | |
} | |
}); | |
var_dump($data); |
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 | |
/** | |
* ImagickProcessor | |
* | |
* @author Frank Liepert <[email protected]> | |
*/ | |
class ImageMagickCommandLineProcessor | |
{ | |
/** @type string $error */ | |
protected $error; |
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 | |
try { | |
$pdflib = new PDFlib; | |
$colorspace = new Colorspace($pdflib); | |
print_r ($colorspace->analyze('test.pdf')); | |
} catch (PDFlibException $e) { | |
print_r ($e); | |
} | |
class Colorspace |
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 Parents | |
{ | |
public function doSomething($x) | |
{ | |
print $x; | |
} | |
} | |
class ChildA extends Parents |
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 Foo | |
{ | |
protected $bar; | |
public function __construct() | |
{ | |
$this->bar = 'bar'; | |
} | |
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 | |
$container->addDefinition('AnotherService', new Definition('Application\Service\AnotherService')) | |
->setter('setFoo', 'Foo'); | |
$container->addDefinition('ExampleService', new Definition('Application\Service\ExampleService')) | |
->constructor(array('@AnotherService')); | |
$container->addDefinition('Session', new Definition('lib\Session\Session')); | |
$container->addDefinition('SessionAwareInterface', new Definition('lib\Session\SessionAwareInterface')) |
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 | |
$string = 'foo'; | |
var_dump(htmlspecialchars($string)); | |
// string(3) "foo" | |
$integer = 1; | |
var_dump(htmlspecialchars($integer)); | |
// string(1) "1" | |
$float = 1.2; |
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 | |
function getInputValueByName($name, $data) { | |
if (strpos($name, '[]') !== false) { | |
$name = str_replace('[]', '', $name); | |
} | |
$parts = explode('[', $name); | |
$value = $data; | |
foreach ($parts as $part) { | |
$part = rtrim($part, ']'); |