- var_export: documentation ( source)
<?php
class A {
const FIELD_1 = 'field1';
const FIELD_2 = 'field2';
const FIELD_A = 'fieldA';
const FIELD_B = 'fieldB';
private $field = array(
self::FIELD_1 => self::FIELD_A,
self::FIELD_2 => self::FIELD_B
);
public function getField() {
return $this->field;
}
}
$a = new A;
$str = var_export($a->getField());
echo '$field = ' . $str . ';';