Skip to content

Instantly share code, notes, and snippets.

View ClasslessAndFree's full-sized avatar

Josh ClasslessAndFree

  • Portland, OR
View GitHub Profile
@ClasslessAndFree
ClasslessAndFree / PHP: Recursive Search
Created April 23, 2012 11:27 — forked from pghoratiu/search.php
PHP: Recursive Search
@ClasslessAndFree
ClasslessAndFree / PHP Curl example
Created April 23, 2012 11:09 — forked from kishorek/PHP Curl example
PHP: Curl function
<?php
function curl_download($Url){
// is cURL installed yet?
if (!function_exists('curl_init')){
die('Sorry cURL is not installed!');
}
// OK cool - then let's create a new cURL resource handle
public function save()
{
//
// Find the root ID of the category to make selecting much easier
//
// Get all categories
$all_categories = $this->all_categories();
$parent_id = $this->get_parent_id();
@ClasslessAndFree
ClasslessAndFree / PHP: File Recursion
Created April 23, 2012 10:58 — forked from leighmcculloch/file_recursive.php
PHP: Recursive Directory Functions
function recursive_delete($dir) {
$iterator = new RecursiveIteratorIterator(new RecursiveDirectoryIterator($dir), RecursiveIteratorIterator::CHILD_FIRST);
foreach ($iterator as $file) {
$path = $file->__toString();
if($file->isDir()) {
rmdir($path);
} else {
unlink($path);
}
}