PHP8
[m6w6/seekat] / lib / functions.php
1 <?php
2
3 namespace {
4 if (!function_exists("uri_template")) {
5 function uri_template(string $str, array $arr = []) : string {
6 $tpl = new \Rize\UriTemplate;
7 return $tpl->expand($str, $arr);
8 }
9 }
10 }
11
12 namespace seekat {
13 /**
14 * Generate a human readable representation of a variable
15 * @param mixed $arg
16 * @param bool $export whether to var_export the $arg
17 * @return string
18 */
19 function typeof($arg, $export = false) {
20 $type = is_object($arg)
21 ? "instance of ".get_class($arg)
22 : gettype($arg);
23 if ($export) {
24 $type .= ": ".var_export($arg, true);
25 }
26 return $type;
27 }
28 }