diff --git a/reference/array/functions/array-diff-uassoc.xml b/reference/array/functions/array-diff-uassoc.xml index 70edae452d..c7417b1aa3 100644 --- a/reference/array/functions/array-diff-uassoc.xml +++ b/reference/array/functions/array-diff-uassoc.xml @@ -1,5 +1,5 @@ - + @@ -33,8 +33,11 @@ $b)? 1:-1; } diff --git a/reference/array/functions/array-filter.xml b/reference/array/functions/array-filter.xml index 5592dfc125..2d60ebe5d7 100644 --- a/reference/array/functions/array-filter.xml +++ b/reference/array/functions/array-filter.xml @@ -1,5 +1,5 @@ - + @@ -29,11 +29,13 @@ - + @@ -31,7 +31,8 @@ $m)); } diff --git a/reference/array/functions/array-reduce.xml b/reference/array/functions/array-reduce.xml index eef140c846..4ec1bd794a 100644 --- a/reference/array/functions/array-reduce.xml +++ b/reference/array/functions/array-reduce.xml @@ -1,5 +1,5 @@ - + @@ -31,12 +31,14 @@ - + @@ -34,14 +34,18 @@ priv_member = $val; } - function comp_func_cr($a, $b) { + + function comp_func_cr($a, $b) + { if ($a->priv_member === $b->priv_member) return 0; return ($a->priv_member > $b->priv_member)? 1:-1; } } + $a = array("0.1" => new cr(9), "0.5" => new cr(12), 0 => new cr(23), 1=> new cr(4), 2 => new cr(-15),); $b = array("0.2" => new cr(9), "0.5" => new cr(22), 0 => new cr(3), 1=> new cr(4), 2 => new cr(-15),); diff --git a/reference/array/functions/array-udiff-uassoc.xml b/reference/array/functions/array-udiff-uassoc.xml index fee2a2346e..bafaa766fa 100644 --- a/reference/array/functions/array-udiff-uassoc.xml +++ b/reference/array/functions/array-udiff-uassoc.xml @@ -1,5 +1,5 @@ - + @@ -39,14 +39,19 @@ priv_member = $val; } - function comp_func_cr($a, $b) { + + function comp_func_cr($a, $b) + { if ($a->priv_member === $b->priv_member) return 0; return ($a->priv_member > $b->priv_member)? 1:-1; } - function comp_func_key($a, $b) { + + function comp_func_key($a, $b) + { if ($a === $b) return 0; return ($a > $b)? 1:-1; } diff --git a/reference/array/functions/array-udiff.xml b/reference/array/functions/array-udiff.xml index fd8e9249f8..fa7431f8b9 100644 --- a/reference/array/functions/array-udiff.xml +++ b/reference/array/functions/array-udiff.xml @@ -1,5 +1,5 @@ - + @@ -35,10 +35,13 @@ priv_member = $val; } - function comp_func_cr($a, $b) { + + function comp_func_cr($a, $b) + { if ($a->priv_member === $b->priv_member) return 0; return ($a->priv_member > $b->priv_member)? 1:-1; } diff --git a/reference/array/functions/array-walk.xml b/reference/array/functions/array-walk.xml index 9d50ffa37d..fed91ec93a 100644 --- a/reference/array/functions/array-walk.xml +++ b/reference/array/functions/array-walk.xml @@ -1,5 +1,5 @@ - + @@ -77,11 +77,13 @@ "lemon", "a" => "orange", "b" => "banana", "c" => "apple"); -function test_alter(&$item1, $key, $prefix) { +function test_alter(&$item1, $key, $prefix) +{ $item1 = "$prefix: $item1"; } -function test_print($item2, $key) { +function test_print($item2, $key) +{ echo "$key. $item2
\n"; } diff --git a/reference/array/functions/uksort.xml b/reference/array/functions/uksort.xml index d215d13e17..55aafee002 100644 --- a/reference/array/functions/uksort.xml +++ b/reference/array/functions/uksort.xml @@ -1,5 +1,5 @@ - + @@ -38,7 +38,8 @@ - + @@ -46,7 +46,8 @@ name = $name; } /* This is the static comparing function: */ - function cmp_obj($a, $b) { + function cmp_obj($a, $b) + { $al = strtolower($a->name); $bl = strtolower($b->name); if ($al == $bl) { diff --git a/reference/classobj/functions/call-user-method.xml b/reference/classobj/functions/call-user-method.xml index 4fc236dc03..425208cc24 100644 --- a/reference/classobj/functions/call-user-method.xml +++ b/reference/classobj/functions/call-user-method.xml @@ -1,5 +1,5 @@ - + @@ -40,12 +40,14 @@ class Country { var $NAME; var $TLD; - function Country($name, $tld) { + function Country($name, $tld) + { $this->NAME = $name; $this->TLD = $tld; } - function print_info($prestr = "") { + function print_info($prestr = "") + { echo $prestr . "Country: " . $this->NAME . "\n"; echo $prestr . "Top Level Domain: " . $this->TLD . "\n"; } diff --git a/reference/classobj/functions/get-class-methods.xml b/reference/classobj/functions/get-class-methods.xml index 1333b23306..caf2ef3294 100644 --- a/reference/classobj/functions/get-class-methods.xml +++ b/reference/classobj/functions/get-class-methods.xml @@ -1,5 +1,5 @@ - + @@ -40,17 +40,20 @@ $class_methods = get_class_methods($my_class); // see below the full example class myclass { // constructor - function myclass() { + function myclass() + { return(true); } // method 1 - function myfunc1() { + function myfunc1() + { return(true); } // method 2 - function myfunc2() { + function myfunc2() + { return(true); } } diff --git a/reference/classobj/functions/get-class.xml b/reference/classobj/functions/get-class.xml index e910933a48..6244c13fb5 100644 --- a/reference/classobj/functions/get-class.xml +++ b/reference/classobj/functions/get-class.xml @@ -1,5 +1,5 @@ - + @@ -32,11 +32,13 @@ - + @@ -35,16 +35,19 @@ class Point2D { var $x, $y; var $label; - function Point2D($x, $y) { + function Point2D($x, $y) + { $this->x = $x; $this->y = $y; } - function setLabel($label) { + function setLabel($label) + { $this->label = $label; } - function getPoint() { + function getPoint() + { return array("x" => $this->x, "y" => $this->y, "label" => $this->label); diff --git a/reference/classobj/functions/get-parent-class.xml b/reference/classobj/functions/get-parent-class.xml index 762dd52a70..054c12b6f3 100644 --- a/reference/classobj/functions/get-parent-class.xml +++ b/reference/classobj/functions/get-parent-class.xml @@ -1,5 +1,5 @@ - + @@ -30,19 +30,22 @@ - + Class/Object Functions Classes/Objects @@ -64,16 +64,19 @@ class Vegetable { var $edible; var $color; - function Vegetable($edible, $color="green") { + function Vegetable($edible, $color="green") + { $this->edible = $edible; $this->color = $color; } - function is_edible() { + function is_edible() + { return $this->edible; } - function what_color() { + function what_color() + { return $this->color; } @@ -84,15 +87,18 @@ class Spinach extends Vegetable { var $cooked = false; - function Spinach() { + function Spinach() + { $this->Vegetable(true, "green"); } - function cook_it() { + function cook_it() + { $this->cooked = true; } - function is_cooked() { + function is_cooked() + { return $this->cooked; } @@ -121,19 +127,22 @@ include "classes.inc"; // utility functions -function print_vars($obj) { +function print_vars($obj) +{ $arr = get_object_vars($obj); while (list($prop, $val) = each($arr)) echo "\t$prop = $val\n"; } -function print_methods($obj) { +function print_methods($obj) +{ $arr = get_class_methods(get_class($obj)); foreach ($arr as $method) echo "\tfunction $method()\n"; } -function class_parentage($obj, $class) { +function class_parentage($obj, $class) +{ if (is_subclass_of($GLOBALS[$obj], $class)) { echo "Object $obj belongs to class " . get_class($$obj); echo " a subclass of $class\n"; diff --git a/reference/datetime/functions/microtime.xml b/reference/datetime/functions/microtime.xml index 913e724cbe..02661a9bf9 100644 --- a/reference/datetime/functions/microtime.xml +++ b/reference/datetime/functions/microtime.xml @@ -1,5 +1,5 @@ - + @@ -43,7 +43,8 @@ - + Database (dbm-style) abstraction layer functions dba @@ -241,8 +241,9 @@ while ($key != false) { $key = dba_nextkey($id); } -for ($i = 0; $i < count($handle_later); $i++) +for ($i = 0; $i < count($handle_later); $i++) { dba_delete($handle_later[$i], $id); +} ?> ]]> diff --git a/reference/dbx/functions/dbx-compare.xml b/reference/dbx/functions/dbx-compare.xml index d5d40d0acd..5f8606e7f4 100644 --- a/reference/dbx/functions/dbx-compare.xml +++ b/reference/dbx/functions/dbx-compare.xml @@ -1,5 +1,5 @@ - + @@ -69,7 +69,8 @@ - + @@ -30,7 +30,8 @@ - +
&reftitle.examples; @@ -16,7 +16,8 @@ error_reporting(0); // user defined error handling function -function userErrorHandler($errno, $errmsg, $filename, $linenum, $vars) { +function userErrorHandler($errno, $errmsg, $filename, $linenum, $vars) +{ // timestamp for the error entry $dt = date("Y-m-d H:i:s (T)"); @@ -61,7 +62,8 @@ function userErrorHandler($errno, $errmsg, $filename, $linenum, $vars) { } -function distance($vect1, $vect2) { +function distance($vect1, $vect2) +{ if (!is_array($vect1) || !is_array($vect2)) { trigger_error("Incorrect parameters, arrays expected", E_USER_ERROR); return NULL; diff --git a/reference/errorfunc/functions/debug-backtrace.xml b/reference/errorfunc/functions/debug-backtrace.xml index 2b2d2240c6..9f43f882a4 100755 --- a/reference/errorfunc/functions/debug-backtrace.xml +++ b/reference/errorfunc/functions/debug-backtrace.xml @@ -1,5 +1,5 @@ - + debug_backtrace @@ -94,7 +94,8 @@ // filename: a.php - + @@ -67,7 +67,8 @@ define("WARNING", E_USER_NOTICE); error_reporting(FATAL | ERROR | WARNING); // error handler function -function myErrorHandler($errno, $errstr, $errfile, $errline) { +function myErrorHandler($errno, $errstr, $errfile, $errline) +{ switch ($errno) { case FATAL: echo "FATAL [$errno] $errstr
\n"; @@ -89,7 +90,8 @@ function myErrorHandler($errno, $errstr, $errfile, $errline) { } // function to test the error handling -function scale_by_log($vect, $scale) { +function scale_by_log($vect, $scale) +{ if (!is_numeric($scale) || $scale <= 0) { trigger_error("log(x) for x <= 0 is undefined, you used: scale = $scale", FATAL); diff --git a/reference/fdf/functions/fdf-next-field-name.xml b/reference/fdf/functions/fdf-next-field-name.xml index d41497e042..9c5718b93e 100644 --- a/reference/fdf/functions/fdf-next-field-name.xml +++ b/reference/fdf/functions/fdf-next-field-name.xml @@ -1,5 +1,5 @@ - + @@ -25,12 +25,12 @@ ]]> diff --git a/reference/filesystem/functions/is-uploaded-file.xml b/reference/filesystem/functions/is-uploaded-file.xml index 02ffb59ed0..e545729658 100644 --- a/reference/filesystem/functions/is-uploaded-file.xml +++ b/reference/filesystem/functions/is-uploaded-file.xml @@ -1,5 +1,5 @@ - + @@ -41,7 +41,8 @@ - + @@ -26,7 +26,8 @@ - + @@ -26,7 +26,8 @@ - + @@ -60,9 +60,11 @@ echo $newfunc(2, M_E) . "\n"; - + @@ -29,7 +29,8 @@ \n"; if ($numargs >= 2) { diff --git a/reference/funchand/functions/func-get-args.xml b/reference/funchand/functions/func-get-args.xml index 86019ecebe..8ab214121b 100644 --- a/reference/funchand/functions/func-get-args.xml +++ b/reference/funchand/functions/func-get-args.xml @@ -1,5 +1,5 @@ - + @@ -25,7 +25,8 @@ \n"; if ($numargs >= 2) { diff --git a/reference/funchand/functions/func-num-args.xml b/reference/funchand/functions/func-num-args.xml index 5b4b738f21..7be3aa94cb 100644 --- a/reference/funchand/functions/func-num-args.xml +++ b/reference/funchand/functions/func-num-args.xml @@ -1,5 +1,5 @@ - + @@ -24,7 +24,8 @@ - + @@ -26,7 +26,8 @@ $id$data\n"; } diff --git a/reference/gmp/reference.xml b/reference/gmp/reference.xml index 242a03149f..4ab4780f18 100644 --- a/reference/gmp/reference.xml +++ b/reference/gmp/reference.xml @@ -1,5 +1,5 @@ - + GMP functions GMP @@ -74,7 +74,8 @@ - + @@ -30,7 +30,8 @@ reason(0); echo "Type: "; switch ($reason->type()) { @@ -48,7 +49,8 @@ function handle_error($error) { echo "Description: " . $reason->description("en") . "
\n"; } -function list_attr($obj) { +function list_attr($obj) +{ echo "\n"; $count = $obj->count(); for ($i=0; $i<$count; $i++) { diff --git a/reference/ibase/functions/ibase-set-event-handler.xml b/reference/ibase/functions/ibase-set-event-handler.xml index 8809f85a3c..767903a2dc 100644 --- a/reference/ibase/functions/ibase-set-event-handler.xml +++ b/reference/ibase/functions/ibase-set-event-handler.xml @@ -1,5 +1,5 @@ - + ibase_set_event_handler @@ -29,17 +29,18 @@ ]]> diff --git a/reference/image/functions/imagecreatefromgif.xml b/reference/image/functions/imagecreatefromgif.xml index 9ce8829c3a..3b55a3a670 100644 --- a/reference/image/functions/imagecreatefromgif.xml +++ b/reference/image/functions/imagecreatefromgif.xml @@ -1,5 +1,5 @@ - + @@ -29,7 +29,8 @@ - + @@ -29,7 +29,8 @@ - + @@ -29,7 +29,8 @@ - + @@ -29,7 +29,8 @@ - + @@ -29,7 +29,8 @@ - + @@ -81,7 +81,8 @@ assert_options(ASSERT_WARNING, 0); assert_options(ASSERT_QUIET_EVAL, 1); // Create a handler function -function my_assert_handler($file, $line, $code) { +function my_assert_handler($file, $line, $code) +{ echo "
Assertion Failed: File '$file'
Line '$line'
diff --git a/reference/ldap/functions/ldap-get-attributes.xml b/reference/ldap/functions/ldap-get-attributes.xml index 0b44e39461..55896ee498 100644 --- a/reference/ldap/functions/ldap-get-attributes.xml +++ b/reference/ldap/functions/ldap-get-attributes.xml @@ -1,5 +1,5 @@ - + @@ -58,8 +58,9 @@ $attrs = ldap_get_attributes($ds, $entry); echo $attrs["count"] . " attributes held for this entry:

"; -for ($i=0; $i<$attrs["count"]; $i++) +for ($i=0; $i<$attrs["count"]; $i++) { echo $attrs[$i] . "
"; +} ?> ]]> diff --git a/reference/ldap/functions/ldap-get-values.xml b/reference/ldap/functions/ldap-get-values.xml index 4f5bb7fb1f..406e28500e 100644 --- a/reference/ldap/functions/ldap-get-values.xml +++ b/reference/ldap/functions/ldap-get-values.xml @@ -1,5 +1,5 @@ - + @@ -63,10 +63,11 @@ return_value[i] = ith value of attribute $values = ldap_get_values($ds, $entry, "mail"); -echo $values["count"] . " email addresses for this entry.

"; +echo $values["count"] . " email addresses for this entry.
"; -for ($i=0; $i < $values["count"]; $i++) +for ($i=0; $i < $values["count"]; $i++) { echo $values[$i] . "
"; +} ?> ]]> diff --git a/reference/ldap/functions/ldap-list.xml b/reference/ldap/functions/ldap-list.xml index 8a5bb9f214..257ed9a61b 100644 --- a/reference/ldap/functions/ldap-list.xml +++ b/reference/ldap/functions/ldap-list.xml @@ -1,5 +1,5 @@ - + @@ -58,8 +58,10 @@ $sr=ldap_list($ds, $basedn, "ou=*", $justthese); $info = ldap_get_entries($ds, $sr); -for ($i=0; $i<$info["count"]; $i++) +for ($i=0; $i<$info["count"]; $i++) { echo $info[$i]["ou"][0] ; +} + ]]> diff --git a/reference/math/functions/mt-srand.xml b/reference/math/functions/mt-srand.xml index 3917d8389c..87ab9b621a 100644 --- a/reference/math/functions/mt-srand.xml +++ b/reference/math/functions/mt-srand.xml @@ -1,5 +1,5 @@ - + @@ -22,7 +22,8 @@ - + @@ -22,7 +22,8 @@ - + @@ -37,7 +37,8 @@ $p = new SWFSprite(); - function label($string) { + function label($string) + { global $f; $t = new SWFTextField(); @@ -48,7 +49,8 @@ return $t; } - function addLabel($string) { + function addLabel($string) + { global $p; $i = $p->add(label($string)); @@ -66,7 +68,8 @@ addLabel("SWFBUTTON_DRAGOVER"); addLabel("SWFBUTTON_DRAGOUT"); - function rect($r, $g, $b) { + function rect($r, $g, $b) + { $s = new SWFShape(); $s->setRightFill($s->addFill($r, $g, $b)); $s->drawLine(600, 0); diff --git a/reference/ming/functions/swfdisplayitem.rotateto.xml b/reference/ming/functions/swfdisplayitem.rotateto.xml index 9bf0fa212e..cff65a912c 100644 --- a/reference/ming/functions/swfdisplayitem.rotateto.xml +++ b/reference/ming/functions/swfdisplayitem.rotateto.xml @@ -1,5 +1,5 @@ - + @@ -43,7 +43,8 @@ // functions with huge numbers of arbitrary // arguments are always a good idea! Really! - function text($r, $g, $b, $a, $rot, $x, $y, $scale, $string) { + function text($r, $g, $b, $a, $rot, $x, $y, $scale, $string) + { global $f, $m; $t = new SWFText(); @@ -71,7 +72,8 @@ return $i; } - function step($i) { + function step($i) + { $oldrot = $i->rot; $i->rot = 19*$i->rot/20; $i->x = (19*$i->x + 1200)/20; diff --git a/reference/objaggregation/functions/aggregate-info.xml b/reference/objaggregation/functions/aggregate-info.xml index 79109b4cbb..1770fb7b04 100644 --- a/reference/objaggregation/functions/aggregate-info.xml +++ b/reference/objaggregation/functions/aggregate-info.xml @@ -1,5 +1,5 @@ - + aggregate_info @@ -30,11 +30,13 @@ class Slicer { var $vegetable; - function Slicer($vegetable) { + function Slicer($vegetable) + { $this->vegetable = $vegetable; } - function slice_it($num_cuts) { + function slice_it($num_cuts) + { echo "Doing some simple slicing\n"; for ($i=0; $i < $num_cuts; $i++) { // do some slicing @@ -46,11 +48,13 @@ class Dicer { var $vegetable; var $rotation_angle = 90; // degrees - function Dicer($vegetable) { + function Dicer($vegetable) + { $this->vegetable = $vegetable; } - function dice_it($num_cuts) { + function dice_it($num_cuts) + { echo "Cutting in one direction\n"; for ($i=0; $i < $num_cuts; $i++) { // do some cutting @@ -62,11 +66,13 @@ class Dicer { } } - function rotate($deg) { + function rotate($deg) + { echo "Now rotating {$this->vegetable} {$deg} degrees\n"; } - function _secret_super_dicing($num_cuts) { + function _secret_super_dicing($num_cuts) + { // so secret we cannot show you ;-) } } diff --git a/reference/objaggregation/reference.xml b/reference/objaggregation/reference.xml index 965d1a79fe..81630315a4 100644 --- a/reference/objaggregation/reference.xml +++ b/reference/objaggregation/reference.xml @@ -1,5 +1,5 @@ - + Object Aggregation/Composition Functions Object Aggregation @@ -31,11 +31,13 @@ _dt = new DateTime(); // initialization code ... } - function generateReport() { + function generateReport() + { $dateTime = $_dt->now(); // more code ... } @@ -78,11 +82,13 @@ class DateTime { class DateTimePlus { var $_format; - function DateTimePlus($format="Y-m-d H:i:s") { + function DateTimePlus($format="Y-m-d H:i:s") + { $this->_format = $format; } - function now() { + function now() + { return date($this->_format); } } @@ -91,15 +97,18 @@ class Report { var $_dt; // we'll keep the reference to DateTime here // more properties ... - function Report() { + function Report() + { // do some initialization } - function setDateTime(&$dt) { + function setDateTime(&$dt) + { $this->_dt =& $dt; } - function generateReport() { + function generateReport() + { $dateTime = $this->_dt->now(); // more code ... } @@ -161,10 +170,13 @@ $output = $rep->generateReport(); class FileStorage { var $data; - function FileStorage($data) { + function FileStorage($data) + { $this->data = $data; } - function write($name) { + + function write($name) + { $fp = fopen(name, "w"); fwrite($fp, $this->data); fclose($data); @@ -176,12 +188,14 @@ class WDDXStorage { var $version = "1.0"; var $_id; // "private" variable - function WDDXStorage($data) { + function WDDXStorage($data) + { $this->data = $data; $this->_id = $this->_genID(); } - function store() { + function store() + { if ($this->_id) { $pid = wddx_packet_start($this->_id); wddx_add_vars($pid, "this->data"); @@ -195,7 +209,8 @@ class WDDXStorage { } // a private method - function _genID() { + function _genID() + { return md5(uniqid(rand(), true)); } } @@ -204,11 +219,13 @@ class DBStorage { var $data; var $dbtype = "mysql"; - function DBStorage($data) { + function DBStorage($data) + { $this->data = $data; } - function save() { + function save() + { $dbh = mysql_connect(); mysql_select_db("storage", $dbh); $serdata = serialize($this->data); @@ -237,13 +254,15 @@ include "storageclasses.inc"; // some utilty functions -function p_arr($arr) { +function p_arr($arr) +{ foreach ($arr as $k => $v) $out[] = "\t$k => $v"; return implode("\n", $out); } -function object_info($obj) { +function object_info($obj) +{ $out[] = "Class: " . get_class($obj); foreach (get_object_vars($obj) as $var=>$val) { if (is_array($val)) { diff --git a/reference/oci8/functions/ocilogon.xml b/reference/oci8/functions/ocilogon.xml index 63818fa4fe..8681e84669 100644 --- a/reference/oci8/functions/ocilogon.xml +++ b/reference/oci8/functions/ocilogon.xml @@ -1,5 +1,5 @@ - + @@ -41,42 +41,49 @@ $db = ""; $c1 = ocilogon("scott", "tiger", $db); $c2 = ocilogon("scott", "tiger", $db); -function create_table($conn) { +function create_table($conn) +{ $stmt = ociparse($conn, "create table scott.hallo (test varchar2(64))"); ociexecute($stmt); echo $conn . " created table\n\n"; } -function drop_table($conn) { +function drop_table($conn) +{ $stmt = ociparse($conn, "drop table scott.hallo"); ociexecute($stmt); echo $conn . " dropped table\n\n"; } -function insert_data($conn) { +function insert_data($conn) +{ $stmt = ociparse($conn, "insert into scott.hallo values('$conn' || ' ' || to_char(sysdate,'DD-MON-YY HH24:MI:SS'))"); ociexecute($stmt, OCI_DEFAULT); echo $conn . " inserted hallo\n\n"; } -function delete_data($conn) { +function delete_data($conn) +{ $stmt = ociparse($conn, "delete from scott.hallo"); ociexecute($stmt, OCI_DEFAULT); echo $conn . " deleted hallo\n\n"; } -function commit($conn) { +function commit($conn) +{ ocicommit($conn); echo $conn . " committed\n\n"; } -function rollback($conn) { +function rollback($conn) +{ ocirollback($conn); echo $conn . " rollback\n\n"; } -function select_data($conn) { +function select_data($conn) +{ $stmt = ociparse($conn, "select * from scott.hallo"); ociexecute($stmt, OCI_DEFAULT); echo $conn."----selecting\n\n"; diff --git a/reference/oci8/functions/ocinlogon.xml b/reference/oci8/functions/ocinlogon.xml index 844426eb81..d1b298cc56 100644 --- a/reference/oci8/functions/ocinlogon.xml +++ b/reference/oci8/functions/ocinlogon.xml @@ -1,5 +1,5 @@ - + @@ -45,43 +45,50 @@ $db = ""; $c1 = ocilogon("scott", "tiger", $db); $c2 = ocinlogon("scott", "tiger", $db); -function create_table($conn) { +function create_table($conn) +{ $stmt = ociparse($conn, "create table scott.hallo (test varchar2(64))"); ociexecute($stmt); echo $conn . " created table\n\n"; } -function drop_table($conn) { +function drop_table($conn) +{ $stmt = ociparse($conn, "drop table scott.hallo"); ociexecute($stmt); echo $conn . " dropped table\n\n"; } -function insert_data($conn) { +function insert_data($conn) +{ $stmt = ociparse($conn, "insert into scott.hallo values('$conn' || ' ' || to_char(sysdate,'DD-MON-YY HH24:MI:SS'))"); ociexecute($stmt, OCI_DEFAULT); echo $conn . " inserted hallo\n\n"; } -function delete_data($conn) { +function delete_data($conn) +{ $stmt = ociparse($conn, "delete from scott.hallo"); ociexecute($stmt, OCI_DEFAULT); echo $conn . " deleted hallo\n\n"; } -function commit($conn) { +function commit($conn) +{ ocicommit($conn); echo $conn . " committed\n\n"; } -function rollback($conn) { +function rollback($conn) +{ ocirollback($conn); echo $conn . " rollback\n\n"; } -function select_data($conn) { +function select_data($conn) +{ $stmt = ociparse($conn, "select * from scott.hallo"); ociexecute($stmt, OCI_DEFAULT); echo $conn . "----selecting\n\n"; diff --git a/reference/outcontrol/functions/ob-start.xml b/reference/outcontrol/functions/ob-start.xml index 0a6d0e60c5..870511cd4b 100644 --- a/reference/outcontrol/functions/ob-start.xml +++ b/reference/outcontrol/functions/ob-start.xml @@ -1,5 +1,5 @@ - + @@ -79,7 +79,8 @@ - + Object property and method call overloading Object overloading @@ -62,7 +62,8 @@ class OO { var $elem = array('b' => 9, 'c' => 42); // Callback method for getting a property - function __get($prop_name, &$prop_value) { + function __get($prop_name, &$prop_value) + { if (isset($this->elem[$prop_name])) { $prop_value = $this->elem[$prop_name]; return true; @@ -72,7 +73,8 @@ class OO { } // Callback method for setting a property - function __set($prop_name, $prop_value) { + function __set($prop_name, $prop_value) + { $this->elem[$prop_name] = $prop_value; return true; } diff --git a/reference/pcntl/functions/pcntl-signal.xml b/reference/pcntl/functions/pcntl-signal.xml index ab2d97307e..a6e5e05db8 100644 --- a/reference/pcntl/functions/pcntl-signal.xml +++ b/reference/pcntl/functions/pcntl-signal.xml @@ -1,5 +1,5 @@ - + @@ -50,7 +50,8 @@ declare(ticks = 1); // signal handler function -function sig_handler($signo) { +function sig_handler($signo) +{ switch ($signo) { case SIGTERM: diff --git a/reference/pcntl/reference.xml b/reference/pcntl/reference.xml index 46534a7953..727f32a928 100644 --- a/reference/pcntl/reference.xml +++ b/reference/pcntl/reference.xml @@ -1,5 +1,5 @@ - + Process Control Functions PCNTL @@ -99,7 +99,8 @@ while (1) { } -function sig_handler($signo) { +function sig_handler($signo) +{ switch ($signo) { case SIGTERM: diff --git a/reference/pcre/functions/preg-replace-callback.xml b/reference/pcre/functions/preg-replace-callback.xml index 26e5c15059..88456b043a 100644 --- a/reference/pcre/functions/preg-replace-callback.xml +++ b/reference/pcre/functions/preg-replace-callback.xml @@ -1,5 +1,5 @@ - + @@ -34,7 +34,8 @@ $text.= "Last christmas was 12/24/2001\n"; // the callback function - function next_year($matches) { + function next_year($matches) + { // as usual: $matches[0] is the complete match // $matches[1] the match for the first subpattern // enclosed in '(...)' and so on diff --git a/reference/sesam/functions/sesam-diagnostic.xml b/reference/sesam/functions/sesam-diagnostic.xml index aaecbd8e9f..5a73daf376 100644 --- a/reference/sesam/functions/sesam-diagnostic.xml +++ b/reference/sesam/functions/sesam-diagnostic.xml @@ -1,5 +1,5 @@ - + @@ -80,7 +80,8 @@ // Function which prints a formatted error message, // displaying a pointer to the syntax error in the // SQL statement -function PrintReturncode($exec_str) { +function PrintReturncode($exec_str) +{ $err = Sesam_Diagnostic(); $colspan=4; // 4 cols for: sqlstate, errlin, errcol, rowcount if ($err["errlin"] == -1) @@ -108,12 +109,14 @@ function PrintReturncode($exec_str) { $i = ""; $line = substr ($errstmt, 0, strlen ($errstmt)-strlen($i)+1); $errstmt = substr($i, 1); - for ($col=0; $col < $err["errcol"]; ++$col) + for ($col=0; $col < $err["errcol"]; ++$col) { echo (substr($line, $col, 1) == "\t") ? "\t" : "."; + } echo "\\\n"; echo "" . htmlspecialchars($line) . ""; - for ($col=0; $col < $err["errcol"]; ++$col) + for ($col=0; $col < $err["errcol"]; ++$col) { echo (substr ($line, $col, 1) == "\t") ? "\t" : "."; + } echo "/\n"; } } diff --git a/reference/session/functions/session-set-save-handler.xml b/reference/session/functions/session-set-save-handler.xml index ae981d1e51..1cc375aef1 100644 --- a/reference/session/functions/session-set-save-handler.xml +++ b/reference/session/functions/session-set-save-handler.xml @@ -1,5 +1,5 @@ - + @@ -65,7 +65,8 @@ - + sqlite_create_aggregate @@ -56,13 +56,15 @@ foreach ($data as $str) { sqlite_query($dbhandle, "INSERT INTO strings VALUES ('$str')"); } -function max_len_step(&$context, $string) { +function max_len_step(&$context, $string) +{ if (strlen($string) > $context) { $context = strlen($string); } } -function max_len_finalize(&$context) { +function max_len_finalize(&$context) +{ return $context; } diff --git a/reference/sqlite/functions/sqlite-create-function.xml b/reference/sqlite/functions/sqlite-create-function.xml index e387a24cd8..87c959982a 100644 --- a/reference/sqlite/functions/sqlite-create-function.xml +++ b/reference/sqlite/functions/sqlite-create-function.xml @@ -1,5 +1,5 @@ - + sqlite_create_function @@ -43,7 +43,8 @@ - + sqlite_udf_decode_binary @@ -51,14 +51,16 @@ foreach ($data as $str) { sqlite_query($db, "INSERT INTO strings VALUES ('$str')"); } -function max_len_step(&$context, $string) { +function max_len_step(&$context, $string) +{ $string = sqlite_udf_decode_binary($string); if (strlen($string) > $context) { $context = strlen($string); } } -function max_len_finalize(&$context) { +function max_len_finalize(&$context) +{ return $context; } diff --git a/reference/stream/functions/stream-filter-register.xml b/reference/stream/functions/stream-filter-register.xml index e571dfe93c..14b35d11a8 100644 --- a/reference/stream/functions/stream-filter-register.xml +++ b/reference/stream/functions/stream-filter-register.xml @@ -1,5 +1,5 @@ - + stream_filter_register @@ -160,7 +160,8 @@ /* Define our filter class */ class strtoupper_filter extends php_user_filter { - function filter($in, $out, &$consumed, $closing) { + function filter($in, $out, &$consumed, $closing) + { while ($bucket = stream_bucket_make_writeable($in)) { $bucket->data = strtoupper($bucket->data); $consumed += $bucket->datalen; @@ -215,7 +216,8 @@ EASY AS 123 class string_filter extends php_user_filter { var $mode; - function filter($in, $out, &$consumed, $closing) { + function filter($in, $out, &$consumed, $closing) + { while ($bucket = stream_bucket_make_writeable($in)) { if ($this->mode == 1) { $bucket->data = strtoupper($bucket->data); @@ -229,7 +231,8 @@ class string_filter extends php_user_filter { return PSFS_PASS_ON; } - function oncreate() { + function oncreate() + { if ($this->filtername == 'str.toupper') { $this->mode = 1; } elseif ($this->filtername == 'str.tolower') { diff --git a/reference/stream/functions/stream-wrapper-register.xml b/reference/stream/functions/stream-wrapper-register.xml index 8cb8385cf6..a9611435a9 100644 --- a/reference/stream/functions/stream-wrapper-register.xml +++ b/reference/stream/functions/stream-wrapper-register.xml @@ -1,5 +1,5 @@ - + stream_wrapper_register @@ -404,7 +404,8 @@ class VariableStream { var $position; var $varname; - function stream_open($path, $mode, $options, &$opened_path) { + function stream_open($path, $mode, $options, &$opened_path) + { $url = parse_url($path); $this->varname = $url["host"]; $this->position = 0; @@ -412,13 +413,15 @@ class VariableStream { return true; } - function stream_read($count) { + function stream_read($count) + { $ret = substr($GLOBALS[$this->varname], $this->position, $count); $this->position += strlen($ret); return $ret; } - function stream_write($data) { + function stream_write($data) + { $left = substr($GLOBALS[$this->varname], 0, $this->position); $right = substr($GLOBALS[$this->varname], $this->position + strlen($data)); $GLOBALS[$this->varname] = $left . $data . $right; @@ -426,15 +429,18 @@ class VariableStream { return strlen($data); } - function stream_tell() { + function stream_tell() + { return $this->position; } - function stream_eof() { + function stream_eof() + { return $this->position >= strlen($GLOBALS[$this->varname]); } - function stream_seek($offset, $whence) { + function stream_seek($offset, $whence) + { switch ($whence) { case SEEK_SET: if ($offset < strlen($GLOBALS[$this->varname]) && $offset >= 0) { diff --git a/reference/strings/functions/html-entity-decode.xml b/reference/strings/functions/html-entity-decode.xml index 0d576f2576..0276fabaf0 100644 --- a/reference/strings/functions/html-entity-decode.xml +++ b/reference/strings/functions/html-entity-decode.xml @@ -1,5 +1,5 @@ - + @@ -76,7 +76,8 @@ echo $b; // I'll "walk" the dog now // For users prior to PHP 4.3.0 you may do this: -function unhtmlentities($string) { +function unhtmlentities($string) +{ $trans_tbl = get_html_translation_table(HTML_ENTITIES); $trans_tbl = array_flip($trans_tbl); return strtr($string, $trans_tbl); diff --git a/reference/swf/functions/swf-closefile.xml b/reference/swf/functions/swf-closefile.xml index c632f96ff5..948758f757 100644 --- a/reference/swf/functions/swf-closefile.xml +++ b/reference/swf/functions/swf-closefile.xml @@ -1,5 +1,5 @@ - + @@ -67,7 +67,8 @@ $data ? // void swf_savedata(string data) // Save the generated file a database // for later retrieval -function swf_savedata($data) { +function swf_savedata($data) +{ global $DBHOST, $DBUSER, $DBPASS; diff --git a/reference/sybase/functions/sybase-set-message-handler.xml b/reference/sybase/functions/sybase-set-message-handler.xml index 48d09fa05f..781a842bd9 100644 --- a/reference/sybase/functions/sybase-set-message-handler.xml +++ b/reference/sybase/functions/sybase-set-message-handler.xml @@ -1,5 +1,5 @@ - + sybase_set_message_handler @@ -32,7 +32,8 @@ - + http_build_query @@ -115,7 +115,8 @@ class myClass { var $foo; var $baz; - function myClass() { + function myClass() + { $this->foo = 'bar'; $this->baz = 'boom'; } diff --git a/reference/var/functions/is-callable.xml b/reference/var/functions/is-callable.xml index 609aff2d13..22a11715e8 100644 --- a/reference/var/functions/is-callable.xml +++ b/reference/var/functions/is-callable.xml @@ -1,5 +1,5 @@ - + @@ -55,7 +55,8 @@ // Simple variable containing a function // -function someFunction() { +function someFunction() +{ } $functionVariable = 'someFunction'; @@ -70,7 +71,8 @@ echo $callable_name, "\n"; // someFunction class someClass { - function someMethod() { + function someMethod() + { } } diff --git a/reference/var/functions/is-scalar.xml b/reference/var/functions/is-scalar.xml index 9f7c7a06d3..d2acb6d93d 100644 --- a/reference/var/functions/is-scalar.xml +++ b/reference/var/functions/is-scalar.xml @@ -1,5 +1,5 @@ - + @@ -30,7 +30,8 @@ programmers. --> - + @@ -50,7 +50,8 @@ $serialized_object='O:1:"a":1:{s:5:"value";s:3:"100";}'; // unserialize_callback_func directive available as of PHP 4.2.0 ini_set('unserialize_callback_func', 'mycallback'); // set your callback_function -function mycallback($classname) { +function mycallback($classname) +{ // just include a file containing your classdefinition // you get $classname to figure out which classdefinition is required } diff --git a/reference/var/functions/unset.xml b/reference/var/functions/unset.xml index 5b998fea1b..2ecb7105bb 100644 --- a/reference/var/functions/unset.xml +++ b/reference/var/functions/unset.xml @@ -1,5 +1,5 @@ - + @@ -57,7 +57,8 @@ unset($foo1, $foo2, $foo3); - + @@ -144,13 +144,15 @@ class AminoAcid { var $code; // one letter code var $type; // hydrophobic, charged or neutral - function AminoAcid ($aa) { + function AminoAcid ($aa) + { foreach ($aa as $k=>$v) $this->$k = $aa[$k]; } } -function readDatabase($filename) { +function readDatabase($filename) +{ // read the XML database of aminoacids $data = implode("", file($filename)); $parser = xml_parser_create(); @@ -177,9 +179,11 @@ function readDatabase($filename) { return $tdb; } -function parseMol($mvalues) { - for ($i=0; $i < count($mvalues); $i++) +function parseMol($mvalues) +{ + for ($i=0; $i < count($mvalues); $i++) { $mol[$mvalues[$i]["tag"]] = $mvalues[$i]["value"]; + } return new AminoAcid($mol); } diff --git a/reference/xml/functions/xml-set-object.xml b/reference/xml/functions/xml-set-object.xml index b1e8c53c2b..04b20871f0 100644 --- a/reference/xml/functions/xml-set-object.xml +++ b/reference/xml/functions/xml-set-object.xml @@ -1,5 +1,5 @@ - + @@ -25,7 +25,8 @@ class xml { var $parser; - function xml() { + function xml() + { $this->parser = xml_parser_create(); xml_set_object($this->parser, &$this); @@ -33,19 +34,23 @@ class xml { xml_set_character_data_handler($this->parser, "cdata"); } - function parse($data) { + function parse($data) + { xml_parse($this->parser, $data); } - function tag_open($parser, $tag, $attributes) { + function tag_open($parser, $tag, $attributes) + { var_dump($parser, $tag, $attributes); } - function cdata($parser, $cdata) { + function cdata($parser, $cdata) + { var_dump($parser, $cdata); } - function tag_close($parser, $tag) { + function tag_close($parser, $tag) + { var_dump($parser, $tag); } diff --git a/reference/xml/reference.xml b/reference/xml/reference.xml index 764d1fef69..0c0324ee96 100644 --- a/reference/xml/reference.xml +++ b/reference/xml/reference.xml @@ -1,5 +1,5 @@ - + XML parser functions XML @@ -282,7 +282,8 @@ libexpat.a: $(OBJS) $file = "data.xml"; $depth = array(); -function startElement($parser, $name, $attrs) { +function startElement($parser, $name, $attrs) +{ global $depth; for ($i = 0; $i < $depth[$parser]; $i++) { echo " "; @@ -291,7 +292,8 @@ function startElement($parser, $name, $attrs) { $depth[$parser]++; } -function endElement($parser, $name) { +function endElement($parser, $name) +{ global $depth; $depth[$parser]--; } @@ -339,21 +341,24 @@ $map_array = array( "LITERAL" => "TT" ); -function startElement($parser, $name, $attrs) { +function startElement($parser, $name, $attrs) +{ global $map_array; if ($htmltag == $map_array[$name]) { echo "<$htmltag>"; } } -function endElement($parser, $name) { +function endElement($parser, $name) +{ global $map_array; if ($htmltag == $map_array[$name]) { echo ""; } } -function characterData($parser, $data) { +function characterData($parser, $data) +{ echo $data; } @@ -403,7 +408,8 @@ xml_parser_free($xml_parser); $name"; if (sizeof($attribs)) { while (list($k, $v) = each($attribs)) { @@ -423,15 +430,18 @@ function startElement($parser, $name, $attribs) { echo ">"; } -function endElement($parser, $name) { +function endElement($parser, $name) +{ echo "</$name>"; } -function characterData($parser, $data) { +function characterData($parser, $data) +{ echo "$data"; } -function PIHandler($parser, $target, $data) { +function PIHandler($parser, $target, $data) +{ switch (strtolower($target)) { case "php": global $parser_file; @@ -448,7 +458,8 @@ function PIHandler($parser, $target, $data) { } } -function defaultHandler($parser, $data) { +function defaultHandler($parser, $data) +{ if (substr($data, 0, 1) == "&" && substr($data, -1, 1) == ";") { printf('%s', htmlspecialchars($data)); @@ -481,7 +492,8 @@ function externalEntityRefHandler($parser, $openEntityNames, $base, $systemId, return false; } -function new_xml_parser($file) { +function new_xml_parser($file) +{ global $parser_file; $xml_parser = xml_parser_create(); diff --git a/reference/xslt/functions/xslt-create.xml b/reference/xslt/functions/xslt-create.xml index 4010fdefb0..8e816e0302 100644 --- a/reference/xslt/functions/xslt-create.xml +++ b/reference/xslt/functions/xslt-create.xml @@ -1,5 +1,5 @@ - + @@ -22,7 +22,8 @@ your XML */ /* $xsl -> XSLT file */ diff --git a/reference/yaz/functions/yaz-scan.xml b/reference/yaz/functions/yaz-scan.xml index 000ca2b85f..076eca0383 100644 --- a/reference/yaz/functions/yaz-scan.xml +++ b/reference/yaz/functions/yaz-scan.xml @@ -1,5 +1,5 @@ - + @@ -45,7 +45,8 @@