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 = 0); | |
$path = 'foobar'; | |
var_dump($path); | |
$path = realpath($path); | |
var_dump($path); |
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 string_charset_convert($input, $from, $to) { | |
$output = iconv($from, $to, $string); | |
if($output === false) { | |
return $input; | |
} | |
return $output; | |
} |
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 | |
$array = array( | |
'foo' => 23, | |
'bar' => 42, | |
'foobar' => 1337 | |
); | |
$order = array('foo', 'foobar', '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 | |
class User { | |
/** | |
* @var DateTimeInterface | |
*/ | |
private $birthday; | |
public function setBirthday(DateTimeInterface $birthday) { |
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 Foo1 { | |
private $bar; | |
public function getBar() { | |
if(!$this->bar) { | |
$this->bar = new 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 | |
$y = array( | |
'a', | |
'c', | |
'b', | |
'd' | |
); | |
$x = array( |
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 | |
$pkcs12file = new SplFileInfo(__DIR__.'/passbook.p12'); | |
if(!file_exists($pkcs12file)) { | |
$pkcs12 = new Pkcs12(); | |
$file = new SplFileInfo(__DIR__.'/passbook_certificate.pem'); | |
$certificate = new Certificate($file); | |
$pkcs12->setCertificate($certificate); |
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 PrivateKey { | |
} | |
class Pkcs12 { | |
public function getPrivateKey() { | |
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 | |
$due = new DateTime('2014-12-07 12:22:22'); | |
$diff = $due->diff(new DateTime('now')); | |
var_dump($diff->format('%H:%M:%s')); | |
string(8) "02:00:42" |
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 | |
$document = new DomDocument(); | |
$atom = $document->getNamespace('http://www.w3.org/2005/Atom'); | |
$xhtml = $document->getNamespace('http://www.w3.org/1999/xhtml', 'xhtml'); | |
$feed = $atom->createElement('feed'); | |
$document->appendChild($feed); |