PHP Code Snippets

David Carr

This snippet looks inside a $content variable and looks for all img tags and extracts the src path and created a new img tag from them. This allows classes to be added to images.

Read more

David Carr

This function is used to copy a folder and all its contents and sub folders, its params are as follows:

1) The source folder path
2) The destination path (should not exist)

Read more

David Carr

This function is used to rename all instances of a word in a file.

Pararms are as follows:
1) Path to the file
2) The name to rename
3) The new name to be used

Read more

daok

This class deletes a directory along with its contents no matter how deep/nested its sub-directories are.

Read more

David Carr

Read all CSV files from a directory.

Read more

David Carr

using array_map to apply ste_getcsv to a CSV file to convert it's contents into an array.

Read more

josphat

this script can be use to autopost to facebook groups using graph api

Read more

David Carr

Using preg_split to separate words where a capital letter is found.

Read more

Copyright © 2011 - 2017 created by David Carr Web Developer. All code MIT license. All rights reserved. Built using Simple MVC Framework