Skip to content

Instantly share code, notes, and snippets.

@Billy-
Billy- / gist:7e65c3b3e0027259ab63
Last active August 29, 2015 14:11
Mod_rewrite check
$a = ( in_array('mod_rewrite', apache_get_modules()) || strpos(shell_exec('/usr/local/apache/bin/apachectl -l'), 'mod_rewrite') !== false );
echo 'Mod rewrite is ' . ($a ? 'enabled' : 'disabled');
@Billy-
Billy- / in_array_r()
Created June 22, 2014 15:47
in_array_r() - a multidimensional version of PHP's in_array()
function in_array_r($needle, $haystack, $strict = false) {
foreach ($haystack as $item) {
if (($strict ? $item === $needle : $item == $needle) || (is_array($item) && in_array_r($needle, $item, $strict))) {
return true;
}
}
return false;
}