X-Git-Url: https://git.m6w6.name/?p=m6w6%2Fseekat;a=blobdiff_plain;f=lib%2Ffunctions.php;fp=lib%2Ffunctions.php;h=9130fd40b53074d1cc46cf97605acde67e4a6b65;hp=fdd9ea0a02bf16a0079b8782c065f3b53063390d;hb=2121556150be871684b5046af7cf250b8219128d;hpb=cac6bea94e6cde142c951566fa6387ffa54eb3cb diff --git a/lib/functions.php b/lib/functions.php index fdd9ea0..9130fd4 100644 --- a/lib/functions.php +++ b/lib/functions.php @@ -1,21 +1,28 @@ expand($str, $arr); + } } - return $type; } +namespace seekat { + /** + * Generate a human readable representation of a variable + * @param mixed $arg + * @param bool $export whether to var_export the $arg + * @return string + */ + function typeof($arg, $export = false) { + $type = is_object($arg) + ? "instance of ".get_class($arg) + : gettype($arg); + if ($export) { + $type .= ": ".var_export($arg, true); + } + return $type; + } +}