Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public function phpize_var($var)
- {
- $php = '';
- switch ( gettype($var) )
- {
- case 'boolean':
- $php .= $var === true ? 'true' : 'false';
- break;
- case 'integer':
- case 'double':
- $php .= $var;
- break;
- case 'string':
- $php .= "'" .
- str_replace("'", "\\'", $var) .
- "'";
- break;
- case 'object':
- $php .= '(object)';
- case 'array':
- $php .= 'array(';
- foreach ($var as $key => $value)
- {
- $php .= $this->phpize_var($key) .
- ' => ' .
- $this->phpize_var($value) .
- ', ';
- }
- $php .= ')';
- break;
- case 'NULL':
- $php .= 'NULL';
- break;
- case 'resource':
- default:
- }
- return $php;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement