--TEST-- lcfirst() function --INI-- precision=14 --FILE-- false); public function __call($m, $v) { if (stristr($m, 'set')) { $action = lcfirst(substr($m, 3)); $this->$action = $v[0]; } } public function __set($key, $value) { if (array_key_exists($key, $this->vars)) { $this->vars[$key] = $value; } } public function __get($key) { if (array_key_exists($key, $this->vars)) { return $this->vars[$key]; } } } $class = new Setter(); $class->setPartnerName('partnerName'); var_dump($class->partnerName); echo "\n--- Testing objects ---\n"; /* we get "Recoverable fatal error: saying Object of class could not be converted to string" by default when an object is passed instead of string: The error can be avoided by choosing the __toString magix method as follows: */ class stringObject { function __toString() { return "Hello world"; } } $obj_string = new stringObject; var_dump(lcfirst("$obj_string")); echo "\n--- Testing a longer and heredoc string ---\n"; $string = << --EXPECTF-- Deprecated: Using ${var} in strings is deprecated, use {$var} instead in %s on line %d #### Basic and Various operations #### string(16) "tesTing lcfirst." string(17) "1.testing lcfirst" string(11) "hELLO wORLD" string(11) "hELLO wORLD" string(1) "%0" string(1) "%0" string(2) "%00" string(4) "abcd" string(3) "xyz" string(2) "-3" string(2) "-3" string(6) "-3.344" string(6) "-3.344" string(4) "nULL" string(1) "0" string(1) "0" string(1) "1" string(4) "tRUE" string(1) "1" string(1) "1" string(8) "1.234444" string(0) "" string(5) "fALSE" string(1) " " string(5) " " string(1) "b" string(2) "\t" string(1) " " string(2) "12" string(8) "12twelve" #### Testing miscellaneous inputs #### --- Testing lowercamelcase action call example --- string(%d) "partnerName" --- Testing objects --- string(11) "hello world" --- Testing a longer and heredoc string --- string(639) "abcdefghijklmnopqrstuvwxyz0123456789abcdefghijklmnopqrstuvwxyz0123456789 abcdefghijklmnopqrstuvwxyz0123456789abcdefghijklmnopqrstuvwxyz0123456789 abcdefghijklmnopqrstuvwxyz0123456789abcdefghijklmnopqrstuvwxyz0123456789 abcdefghijklmnopqrstuvwxyz0123456789abcdefghijklmnopqrstuvwxyz0123456789 abcdefghijklmnopqrstuvwxyz0123456789abcdefghijklmnopqrstuvwxyz0123456789 abcdefghijklmnopqrstuvwxyz0123456789abcdefghijklmnopqrstuvwxyz0123456789 abcdefghijklmnopqrstuvwxyz0123456789abcdefghijklmnopqrstuvwxyz0123456789 @#$%^&**&^%$#@!~:())))((((&&&**%$###@@@!!!~~~~@###$%^&* abcdefghijklmnopqrstuvwxyz0123456789abcdefghijklmnopqrstuvwxyz0123456789" --- Testing a heredoc null string --- string(0) "" --- Testing simple and complex syntax strings --- string(5) "world" string(7) "world'S" Warning: Undefined variable $strS in %s on line %d string(0) "" string(6) "worldS" string(6) "worldS" --- Nested lcfirst() --- string(5) "hello" Done