<?php/** * CODETREE * support@mycodetree.com * http://mycodetree.com * */function validateEmail($email) {
if (!eregi("^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,3})$", $email)) {
return false;
}return true;
}
?>
Archive for July 14th, 2009
PHP — Basic email validation with RegEx
July 14th, 2009Ryan’s Recommended application of the month
July 14th, 2009Each month I pick an application that I have used personally and find to be of good value and use and then I spread it’s awareness here on The CodeTree!
This month’s pick is the “Toggl Timer” (http://www.toggl.com)
Now that I have been exploring different avenues with The CodeTree I haven’t been doing hardcore freelancing like I have in the past but when I did and on the occasions that I do, I find that the Toggle Timer is my best friend. There is a small cost to use it’s full potential and to use it in a team environment but for a single developer that is just time-tracking projects, it is free.
I think the feature I appreciate the most is the ‘less is more’ approach the it takes to the application interface. Toggl offers a range of reporting options, client/project relationship management, task/project management and a desktop timer client!
I give Toggl 2 thumbs up!
PHP — Get string between two strings
July 14th, 2009<?php/** * CODETREE * support@mycodetree.com * http://mycodetree.com * */function get_string_between($string, $start, $end){
$string = " " . $string;
$ini = strpos($string,$start);
if ($ini == 0) return "";
$ini += strlen($start);
$len = strpos($string, $end, $ini) – $ini;
return substr($string, $ini, $len);
}
echo get_string_between($fullstring, "[tag]", "[/tag]");
?>
PHP — incremental date list between two points in time
July 14th, 2009<?php/** * CODETREE * support@mycodetree.com * http://mycodetree.com * */$startDate = array('06/30/2009', strtotime('June 30th 2009'));
$endDate = array('08/30/2009', strtotime('August 30th 2009'));
$inc = $startDate[1];
while ($inc < $endDate[1]) {
$inc = $inc + 604800;
$options[] = "<option value='" . date('Y/m/d', $inc) . "'>" . date('F jS, Y', $inc) . "</option>";
}
?>
<select name='date' id='date'>
<option value='<?=$startDate[0];?>'><?=date ('F jS, Y', $startDate[1]);?></option>
<?php
foreach ($options as $value) {
echo $value . "\n";
}
?>
<option value='<?=$endDate[0];?>'><?=date ('F jS, Y', $endDate[1]);?></option>
</select>

