3v4l.org

run code in 500+ PHP versions simultaneously
<?php class CookieType { public string $samesite = "Lax"; public int $expires_or_options { get { return time() + 3600; } } public string $path = "/"; public string $domain = ""; public bool $secure = false; public bool $httponly = true; } function fakeSetCookie( string $name, string $value = "", int $expires_or_options = 0, string $path = "", string $domain = "", bool $secure = false, bool $httponly = false, string $samesite = "Strict", ) { var_dump([ "name" => $name, "value" => $value, "expires_or_options" => $expires_or_options, "path" => $path, "domain" => $domain, "secure" => $secure, "httponly" => $httponly, "samesite" => $samesite, ]); } fakeSetCookie("testName", "testValue", ...new CookieType());
Output for 8.4.1 - 8.4.24, 8.5.0 - 8.5.9
array(8) { ["name"]=> string(8) "testName" ["value"]=> string(9) "testValue" ["expires_or_options"]=> int(1787059013) ["path"]=> string(1) "/" ["domain"]=> string(0) "" ["secure"]=> bool(false) ["httponly"]=> bool(true) ["samesite"]=> string(3) "Lax" }
Output for 8.2.31 - 8.2.33, 8.3.0 - 8.3.33
Parse error: syntax error, unexpected token "{", expecting "," or ";" in /in/lNjSX on line 5
Process exited with code 255.

preferences:
40.82 ms | 792 KiB | 4 Q