Skip to content

Instantly share code, notes, and snippets.

<?php
error_reporting(E_ALL);
interface CartItemInterface
{
public function getPrice(float $from = 0.1, float $to = 100.0): float;
}
class CartItem implements CartItemInterface
<?php
error_reporting(E_ALL);
$context = stream_context_create([
'http' => [
'method' => 'GET',
'header' => "User-Agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/99.0.4844.82 Safari/537.36\r\n"
]
]);
@BlackScorp
BlackScorp / clone.php
Created May 1, 2022 18:26
testing deep clones
<?php
class SubSubChild {
public function __construct(private string $value)
{
}
}
class OtherObject{
public function __construct(private SubSubChild $subSubChild)
{
}
<?xml version="1.0" encoding="UTF-8"?>
<bookstore>
<book category="cooking">
<title lang="en">Everyday Italian</title>
<author>Giada De Laurentiis</author>
<year>2005</year>
<price>30.00</price>
</book>
<?php
class MyObject
{
private string $value;
/**
* @return string
*/
public function getValue(): string
{