PHP code example of prewk / serialized-to-ast
1. Go to this page and download the library: Download prewk/serialized-to-ast library. Choose the download type require. 2. Extract the ZIP file and open the index.php. 3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
prewk / serialized-to-ast example snippets
class Test {
private $foo = "Private Foo";
public $bar = 12345;
protected $baz = ["lorem", "ipsum" => "dolor amet", 67890];
}
$parser = new Prewk\SerializedToAst;
$node = $parser->parse(serialize(new Test));
// Array representation..
$arrayAst = $node->toArray();
// ..or JSON (see below)
$jsonAst = json_encode($node);