PHP::Var - export variable to PHP's expression.
Version 0.022
use PHP::Var qw/ export /; $var = {foo => 1, bar => 2}; # export $exported = export($var); # named variable $named = export('name' => $var); # enclose variables with '<?php' and '?>' $enclosed = export($var, enclose => 1); # purity print $purity = export($var, purity => 1);
$var = {foo => 1, bar => 2}; export($var); # array('foo'=>'1','bar'=>'2',); export('name' => $var); # $name=array('foo'=>'1','bar'=>'2',); export($var, enclose => 1); # <?php # array('foo'=>'1','bar'=>'2',); # ?> export($var, purity => 1); # array( # 'foo' => '1', # 'bar' => '2', # );
When this variable is set, the expression becomes a Pretty print in default.
{ local $PHP::Var::Purity = 1; export($var); # array( # 'foo' => '1', # 'bar' => '2', # ); }
When this variable is set, the expression is enclosed with '<?php' and '?>' in default.
{ local $PHP::Var::Enclose = 1; export($var); # <?php # array('foo'=>'1','bar'=>'2',); # ?> }
PHP::Var::export cannot export the blessed object as data that can be restored.
Taku Amano, <taku at toi-planning.net>
<taku at toi-planning.net>
PHP::Session::Serializer::PHP
You can find documentation for this module with the perldoc command.
perldoc PHP::Var
Copyright 2009 Taku Amano.
This program is free software; you can redistribute it and/or modify it under the terms of either: the GNU General Public License as published by the Free Software Foundation; or the Artistic License.
See http://dev.perl.org/licenses/ for more information.
To install PHP::Var, copy and paste the appropriate command in to your terminal.
cpanm
cpanm PHP::Var
CPAN shell
perl -MCPAN -e shell install PHP::Var
For more information on module installation, please visit the detailed CPAN module installation guide.