This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// This function prints unique vowels (A, E, I, O, U) | |
// from a given string in the order they appear. | |
// A 'Y' is considered a consonant if it begins a string and this string is greater than 1 character. | |
// Otherwise, a 'Y' is considered a vowel. | |
function findVowels ($string) { | |
//Handle 'Y' as a consonant |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class VowelFinder extends Model | |
{ | |
// This function prints unique vowels (A, E, I, O, U) | |
// from a given string in the order they appear. | |
// A 'Y' is considered a consonant if it begins a string and this string is greater than 1 character. | |
// Otherwise, a 'Y' is considered a vowel. | |
public function findVowels($string = '') { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// This function prints the numbers from 1 to 100. | |
// But, for multiples of three it prints 'Fizz' instead of the number | |
// And for multiples of five it prints 'Buzz' instead of the number | |
// But, for numbers which are multiples of both three and five, it only prints 'FizzBuzz' | |
function generateFizzBuzz() { | |
$output = ''; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// define the path and name of cached file | |
$cachefile = 'cached-files/'.date('M-d-Y').'.php'; | |
// define how long we want to keep the file in seconds. I set mine to 5 hours. | |
$cachetime = 18000; | |
// Check if the cached file is still fresh. If it is, serve it up and exit. | |
if (file_exists($cachefile) && time() - $cachetime < filemtime($cachefile)) { | |
include($cachefile); | |
exit; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* @name someFunction | |
* @author | |
* | |
* Basic usage: | |
* someFunction.init(); | |
* | |
* additionally you can use methods like someFunction.methodName(); | |
* |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#301 Redirects for .htaccess | |
#Redirect a single page: | |
Redirect 301 /pagename.php http://www.domain.com/pagename.html | |
#Redirect an entire site: | |
Redirect 301 / http://www.domain.com/ | |
#Redirect an entire site to a sub folder | |
Redirect 301 / http://www.domain.com/subfolder/ |