Find this useful? Enter your email to receive occasional updates for securing PHP code.

Signing you up...

Thank you for signing up!

PHP Decode

--TEST-- ReflectionEnumUnitCase::getValue() --FILE-- <?php enum Foo { case Bar; c..

Decoded Output download

--TEST--
ReflectionEnumUnitCase::getValue()
--FILE--
<?php

enum Foo {
    case Bar;
    case Baz;
}

$barFromReflection = (new ReflectionEnumUnitCase(Foo::class, 'Bar'))->getValue();
$bazFromReflection = (new ReflectionEnumUnitCase(Foo::class, 'Baz'))->getValue();

var_dump($barFromReflection);
var_dump($bazFromReflection);

var_dump(Foo::Bar === $barFromReflection);
var_dump(Foo::Baz === $barFromReflection);

var_dump(Foo::Bar === $bazFromReflection);
var_dump(Foo::Baz === $bazFromReflection);

?>
--EXPECT--
enum(Foo::Bar)
enum(Foo::Baz)
bool(true)
bool(false)
bool(false)
bool(true)

Did this file decode correctly?

Original Code

--TEST--
ReflectionEnumUnitCase::getValue()
--FILE--
<?php

enum Foo {
    case Bar;
    case Baz;
}

$barFromReflection = (new ReflectionEnumUnitCase(Foo::class, 'Bar'))->getValue();
$bazFromReflection = (new ReflectionEnumUnitCase(Foo::class, 'Baz'))->getValue();

var_dump($barFromReflection);
var_dump($bazFromReflection);

var_dump(Foo::Bar === $barFromReflection);
var_dump(Foo::Baz === $barFromReflection);

var_dump(Foo::Bar === $bazFromReflection);
var_dump(Foo::Baz === $bazFromReflection);

?>
--EXPECT--
enum(Foo::Bar)
enum(Foo::Baz)
bool(true)
bool(false)
bool(false)
bool(true)

Function Calls

None

Variables

None

Stats

MD5 7be250a52cb37beb9a3e7eda39a623c7
Eval Count 0
Decode Time 74 ms