Skip to content

Instantly share code, notes, and snippets.

View alairock's full-sized avatar

Skyler Lewis alairock

View GitHub Profile
@alairock
alairock / recursechmod.php
Last active September 8, 2022 15:18
Recursive Chmod in php
<?php
function recursiveChmod ($path, $filePerm=0644, $dirPerm=0755) {
// Check if the path exists
if (!file_exists($path)) {
return(false);
}
// See whether this is a file
if (is_file($path)) {
// Chmod the file with our given filepermissions
@alairock
alairock / xml2phparray.php
Last active February 3, 2017 19:28
convert XML data into a PHP Array
<?php
/*
Working with XML. Usage:
$xml=xml2ary(file_get_contents('1.xml'));
$link=&$xml['ddd']['_c'];
$link['twomore']=$link['onemore'];
// ins2ary(); // dot not insert a link, and arrays with links inside!
echo ary2xml($xml);
*/