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-- Extending the PhpToken class --EXTENSIONS-- tokenizer --FILE-- <?php $code = <<<..

Decoded Output download

--TEST--
Extending the PhpToken class
--EXTENSIONS--
tokenizer
--FILE--
<?php

$code = <<<'PHP'
<?php
FUNCTION FOO() {
    ECHO "bar";
}
PHP;

class MyPhpToken extends PhpToken {
    public int $extra = 123;

    public function getLoweredText(): string {
        return strtolower($this->text);
    }
}

foreach (MyPhpToken::tokenize($code) as $token) {
    echo $token->getLoweredText();

    if ($token->extra !== 123) {
        echo "Missing property!
";
    }
}

?>
--EXPECT--
<?php
function foo() {
    echo "bar";
}
 ?>

Did this file decode correctly?

Original Code

--TEST--
Extending the PhpToken class
--EXTENSIONS--
tokenizer
--FILE--
<?php

$code = <<<'PHP'
<?PHP
FUNCTION FOO() {
    ECHO "bar";
}
PHP;

class MyPhpToken extends PhpToken {
    public int $extra = 123;

    public function getLoweredText(): string {
        return strtolower($this->text);
    }
}

foreach (MyPhpToken::tokenize($code) as $token) {
    echo $token->getLoweredText();

    if ($token->extra !== 123) {
        echo "Missing property!\n";
    }
}

?>
--EXPECT--
<?php
function foo() {
    echo "bar";
}

Function Calls

None

Variables

None

Stats

MD5 06d34116d0fa4fc4c266aa545aacc6fe
Eval Count 0
Decode Time 88 ms