* array ( * ), * )) * On insert: * testArray::__set_state(array( * 'foo' => * array ( * 0 => 'This is a test', * ), * )) * Execution ends. * * * 01-08-20 mks DB-150: original coding * */ class testArray { public array $foo; public function __construct() { $this->foo = []; } public function addString(string $newLine): bool { if (!is_string($newLine)) return false; $this->foo[] = $newLine; return true; } } $objTest = new testArray(); echo 'On init: ' . PHP_EOL; var_export($objTest); echo PHP_EOL; if ($objTest->addString('This is a test')) { echo 'On insert: ' . PHP_EOL; var_export($objTest); echo PHP_EOL; } else { echo 'Failed to insert string!' . PHP_EOL; } echo 'Execution ends.' . PHP_EOL;