Exponential Basic 2.4.0.1 Exponential Basic CMS — PHP Class Reference

eZPHPCreator Class Reference
Utility classes

eZPHPCreator provides a simple interface for creating and executing PHP code. More...

## Detailed Description

eZPHPCreator provides a simple interface for creating and executing PHP code.

To create PHP code you must create an instance of this class, add any number of elements you choose with addDefine(), addVariable(), addVariableUnset(), addVariableUnsetList(), addSpace(), addText(), addMethodCall(), addCodePiece(), addComment() and addInclude(). After that you call store() to write all changes to disk.

$php = new eZPHPCreator( 'cache', 'code.php' );
$php->addComment( 'Auto generated' );
$php->addInclude( 'inc.php' );
$php->addVariable( 'count', 10 );
$php->store();
eZPHPCreator
eZPHPCreator provides a simple interface for creating and executing PHP code.

To restore PHP code you must create an instance of this class, check if you can restore it with canRestore() then restore variables with restore(). The class will include PHP file and run all code, once the file is done it will catch any variables you require and return it to you.

$php = new eZPHPCreator( 'cache', 'code.php' );
if ( $php->canRestore() )
{
$variables = $php->restore( array( 'max_count' => 'count' ) );
print( "Max count was " . $variables['max_count'] );
}
$php->close();

The documentation for this class was generated from the following file:

- ezphpcreator.php

Copyright © 1998 – 2026 7x. All rights reserved. Licensed under the GNU GPLv2+.