MANUAL file:///usr/share/doc/packages/php-doc/index.html but be aware that there are HIDDEN CHAPTERS!!! like file:///usr/share/doc/packages/php-doc/language.variables.scope.htmlma/scop "php5 -l singlefile.php". Does syntax (Lint) check. IGNORES files after the first one specified! NO try {...} finally { }!!! Exceptions work just like Java Exceptions. Only problem is that fatal runtime errors don't throw anything. Therefore, without a finally() block, fatal runtime errors not detected by user code can not be caught. LIMITATION! Undetected fatal errors on a .php web page will just croak the HTTP request. SuSE php.ini file locations: php v.4 CLI: /etc/php.ini php v.4 Apache module: /etc/php.ini php v.5 CLI: /etc/php5/cli/php.ini php v.5 Apache module: /etc/php5/apache2/php.ini N.b.: Syntax errors in php.ini can cause the remainder (or all) of the php.ini file to be silently ignored!! This includes commenting with #. BUGS The PHP5 cli build is screwed up. It insists on being verbose and printing HTML tags with all output. warn_plus_overloading setting DOES NOT WORK either from .ini file or by ini_set(). error_append_string doesn't work (at least for trigger_error() calls). Run "php -v" to see whether your php binary is the CLI (command line) or CGI SAPI (Server API). (The Suse php4 rpm is a CLI build, but php5 rpm is a CGI build). *** Newest 10.0 SuSE has a good php5 cli and Apache module build, each with good config files *** PHP under Apache module definitely requires an Apache stop/start if php.ini is changed. There is only one php.ini file used by all the Apache virtual sites. CLI features php -h (for syntax) Basically first non-switch arg is a PHP script file name. *** I doubt the following. stdin is not available until you open it. STDIN, STDOUT, STDERR. Streams already made with fopen('php://stdX...); (Use like 'fwrite(STDERR, "stderr\n");'). I don't know difference between echo and "fwrite(STDOUT...". -c option DOES NOT WORK. Always uses /etc/php.ini. *** Works with newest Suse 10.0 build!! *** Read input (only works in real CLI mode, not like SuSE's php5 build): $str = fgets(STDIN); if ($str) $str = rtrim($str); Arrays (really maps) Length: sizeof($arr); Some of the docs differentiate between "numerical array keys" and "literal array keys". But freaking Array section doesn't mention this. $aname = array('key1' => 'val1', 'key2', => 'val2'); $aname['key1']; (In some special cases, real array indexes are specified like $array{2}, but usually not. Not documented anywhere that I can find.) Simulated a real array: array(1,2,3) (This actually does array(0->1, 1->2, 2->3).) But indexes do not reset without: $array = array_values($array); push/add: $arr[] = 7; Display with print_r($ar); array_shift($ar); array_push($ar); etc. $str = implode('delim', $ar); // array-VALUES-to-string $ar = explode('delim', $str); // String tokenizer Objects. N.b. NO IMPLICIT this-> inside the Class. I.e., you must code "$this->membername". N.b. STATICS are not preserved across requests. I guess each class gets clinitted anew for each request. I guess need to use a real Java singleton under JSR to preserve anything. (Especially since can't store "resources" in a Session"). class X { public $var = 'x'; public function f() {...} } Member and function visibility specifiers: public/private/protected. Members must specify visibility explicitly. Functions default to public. $instance = new X(); var_dump($instance); # displays the object __autoload automatically invoked to try to load source files for new classes automatically. This tries to load "ClassName.php": function __autoload($class_name) { require_once $class_name . '.php'; } CONS I think can only have one constructor method, but it have default vals for parameters, and may call other methods (of course). function __construct() { parent::__construct(); # Note need to call super-cons explicitly. ...} CLASSNAME::member/function. parent and self are special Class names available only inside the using class. NO $!!! SYNTAX: Cname::$var AND Cname::method() Cname::$var->varmeth() "$this" but "self" and "parent". $object var vs. static class names. DEREFERENCE instance vars: $instance->x = 'newval'; $instance->function(); VS. Cname::$var; Cname::method(). [[ N.b. ONLY time you put $ on final variable/method is for static vars. Constants. Keyword "const". Do not use $ to access. Effectively static. statics and constants may not be accessed through instances. Overriding is clumsy. You code generic "handlers" called by all function or variable accesses. Object Operators: get_class() and instanceof (previously is_a()). To make another reference to same object (as opposed to ref to var name), use "$newref =& $origvar;" I think this is equivalent to "obj2 = obb1;" in Java (but not "primitive2 = primitive1;". # comment // comment /* comment */ N.b. that PHP in XML comments STILL EXECUTES. E.g. " will write "