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
| $time_start = microtime(true); | |
| $total = '10000' // records count; | |
| for($i=0; $i <= $total; $i++) | |
| { | |
| $counter++; | |
| $remaining = ($total - $counter); | |
| $timeTaken = microtime(true) - $time_start; | |
| $linesProcessed = $counter; |
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 | |
| // Generates a strong password of N length containing at least one lower case letter, | |
| // one uppercase letter, one digit, and one special character. The remaining characters | |
| // in the password are chosen at random from those four sets. | |
| // | |
| // The available characters in each set are user friendly - there are no ambiguous | |
| // characters such as i, l, 1, o, 0, etc. This, coupled with the $add_dashes option, | |
| // makes it much easier for users to manually type or speak their passwords. | |
| // | |
| // Note: the $add_dashes option will increase the length of the password by |
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
| /** | |
| * | |
| * Get parent categories for a course | |
| * | |
| * @param stdClass|int $course | |
| * @return array | |
| */ | |
| function course_get_parent_categories($course) | |
| { | |
| global $DB; |
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
| /** | |
| * | |
| * @param int $min | |
| * @param int $max | |
| * @param int $type 1=alpha|2=alnum|3=numeric | |
| * @return string|int | |
| */ | |
| function app_random($min = 6, $max = 10, $type = 1) | |
| { | |
| $letters = 'abcdefghijklmnpqrstuvwxyzABCDEFGHIJKLMNPQRSTUVWXYZ'; |
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
| function header_status($statusCode, $exit = false) | |
| { | |
| static $statusCodes = null; | |
| if ($statusCodes === null) | |
| { | |
| $statusCodes = array ( | |
| 100 => 'Continue', | |
| 101 => 'Switching Protocols', | |
| 102 => 'Processing', |
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
| function cut_word($text, $max) | |
| { | |
| if(strlen($text) > $max) | |
| { | |
| if(substr($text, 0, ($max + 1)) != ' ') | |
| { | |
| $text = substr($text, 0, $max); | |
| $exploded = explode(' ', $text); | |
| array_pop($exploded); |