3 |
// $Id$ |
// $Id$ |
4 |
// ----------------------------------------------------------------------------- |
// ----------------------------------------------------------------------------- |
5 |
// $Log$ |
// $Log$ |
6 |
|
// Revision 1.7 2003/03/01 05:05:55 joko |
7 |
|
// minor modification to 'Dumper' |
8 |
|
// |
9 |
|
// Revision 1.6 2003/02/09 17:49:53 joko |
10 |
|
// - removed old code |
11 |
|
// |
12 |
|
// Revision 1.5 2003/02/04 08:22:34 joko |
13 |
|
// + function is_hash |
14 |
|
// + function array_join_merge |
15 |
|
// |
16 |
// Revision 1.4 2002/12/22 13:29:54 jonen |
// Revision 1.4 2002/12/22 13:29:54 jonen |
17 |
// + added number format helper functions: |
// + added number format helper functions: |
18 |
// + number_format_locale() |
// + number_format_locale() |
93 |
return "valid"; |
return "valid"; |
94 |
} |
} |
95 |
|
|
96 |
function dumpVar($var) { |
function Dumper() { |
|
return Dumper($var); |
|
|
} |
|
|
|
|
|
function Dumper($var) { |
|
97 |
ob_start(); |
ob_start(); |
98 |
print_r($var); |
$arg_list = func_get_args(); |
99 |
|
$count = 1; |
100 |
|
foreach ($arg_list as $arg) { |
101 |
|
//print "<hr/>"; |
102 |
|
print_r($arg); |
103 |
|
$count++; |
104 |
|
} |
105 |
$var_dump = ob_get_contents(); |
$var_dump = ob_get_contents(); |
106 |
ob_end_clean(); |
ob_end_clean(); |
107 |
$var_dump = str_replace("\n", "<br>", $var_dump); |
$var_dump = str_replace("\n", "<br>", $var_dump); |
162 |
return $birthday; |
return $birthday; |
163 |
} |
} |
164 |
|
|
|
/* |
|
|
function dprint($message) { |
|
|
print '<span style="font-family:Verdana,Helvetica;font-size:7pt;">'; |
|
|
print $message; |
|
|
print '</span><br>'; |
|
|
} |
|
|
*/ |
|
|
|
|
165 |
function number_format_storage($string) { |
function number_format_storage($string) { |
166 |
$locale_info = localeconv(); |
$locale_info = localeconv(); |
167 |
$string = str_replace($locale_info["decimal_point"], ".", $string); |
$string = str_replace($locale_info["decimal_point"], ".", $string); |
189 |
} |
} |
190 |
} |
} |
191 |
|
|
192 |
|
|
193 |
|
// from: php.net - http://www.php.net/manual/en/function.array-merge-recursive.php |
194 |
|
function is_hash( $var ) { |
195 |
|
if( is_array( $var ) ) { |
196 |
|
$keys = array_keys( $var ); |
197 |
|
$all_num = true; |
198 |
|
for( $i=0; $i<count($keys); $i++ ) |
199 |
|
if( is_string($keys[$i] ) ) return true; |
200 |
|
} |
201 |
|
return false; |
202 |
|
} |
203 |
|
|
204 |
|
// from: php.net - http://www.php.net/manual/en/function.array-merge-recursive.php |
205 |
|
function array_join_merge( $arr1, $arr2 ) { |
206 |
|
if( is_array( $arr1 ) and is_array( $arr2 ) ) { |
207 |
|
// the same -> merge |
208 |
|
$new_array = array(); |
209 |
|
|
210 |
|
if( is_hash( $arr1 ) and is_hash( $arr2 ) ) { |
211 |
|
// hashes -> merge based on keys |
212 |
|
$keys = array_merge( array_keys( $arr1 ), array_keys( $arr2 ) ); |
213 |
|
foreach( $keys as $key ) { |
214 |
|
$new_array[$key] = array_join_merge( $arr1[$key], $arr2[$key] ); |
215 |
|
} |
216 |
|
} else { |
217 |
|
// two real arrays -> merge |
218 |
|
$new_array = |
219 |
|
array_reverse(array_unique(array_reverse(array_merge($arr1,$arr2)))); |
220 |
|
} |
221 |
|
|
222 |
|
return $new_array; |
223 |
|
} else { |
224 |
|
// not the same ... take new one if defined, else the old one stays |
225 |
|
return $arr2 ? $arr2 : $arr1; |
226 |
|
} |
227 |
|
} |
228 |
|
|
229 |
?> |
?> |