#!/usr/bin/php -qC $var) { $opt = stripslashes(substr($uu[2][$i],1)); $type = vartype($var, $opt); $c .= " * @param $type $var " . ($opt ? "(optional) $opt" : "") . "\n"; if ($i==0) { $retype = $type; } } return $c ? " *\n$c" . " * @return $retype\n" : ""; } function vartype($name, $defval="") { $deftype = array( "/^[\"\']/" => "string", "/array\(/" => "array", "/^\d+$/" => "integer", ); foreach ($deftype as $rx=>$t) if (preg_match($rx, $defval)) { return $t; } $typenames = array( "/int|num|size|count|index|time|offs|len|flags/i" => "integer", "/bool|option/i" => "boolean", "/str|needle|name|char|form|call|func/i" => "string", "/obj|class/i" => "object", "/hash|list|keys|values|search|arr/i" => "array", "/data|var/i" => "mixed", "/asc|desc/i" => "boolean", ); foreach ($typenames as $rx=>$t) if (preg_match($rx, $name)) { return $t; } return "mixed"; } ?>