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