If you haven’t noticed I haven’t been writing functions latley.
I have been here: http://microsoftcore.tumblr.com it’s my non-function rambleings.
<?php
function birthday($date=NULL){
$date = ($date == NULL || $date == “”) ? date(“Y-m-d”) : $date ;
if($date == “2009-02-6”){return “Yes it is! w00t. <br />”;} else {
return “Nope…, Sorry <br />”;
}
}
print “is it my birthday? <br />”;
print birthday();
?>
shout out to b_heyer for pointing out my repeats.
<?php
$height = 2000;
function falling($height){
$ground = 0;
$free = 1;
for($i=1000;$i>$ground; $i—){
$height = $height + $free;
$i = $i + $free;
}
}
$free = falling($ground);
?>
<?php
$time = 1800;
function energy($seconds){
$mm_open = array();
for($seconds;$seconds>=0;$seconds—){
$open = 50;
$eyes_open_mm = ($seconds / $open) . “mm”;
array_push($mm_open, $eyes_open_mm);
}
return $mm_open;
}
$mm = energy($time);
print “<pre>”;
print_r($mm);
print “</pre>”;
?>
<script type=”text/javascript”>
function refresh(){
location.reload(true);
}
refresh();
</script>
<?php
function christmas(){
$christmas = date(“U”, strtotime(“december 25”));
$now = date(“U”);
$days_till = round((((($christmas - $now)/60)/60)/24));
return “Days till Christmas: ” . $days_till;
}
print christmas();
?>
<?php
$days = date(“t”);
days_go_by($days);
function days_go_by($days, $us=”us”, $you=”you”){
do{
if(strstr($us, $you)){
break;
}
$day++;
} while($day <= $days);
}
?>
function word($palabra){
$elevation = 4600;
$multiplier = 2;
$flying_at = 0;
for($ft=0;$ft<$elevation;$ft++){
$flying_at = ($ft + $flying_at) * $multiplier;
print “$palabra is currently flying at: $flying_at feet <br />\n”;
}
}
word(“词”);
<?php
$time = array(
‘7pm’ => ‘awake’,
‘7:30pm’ => ‘asleep’,
‘8:00pm’ => ‘still asleep’,
‘11:00pm’ => ‘awake’,
‘11:30pm’ => ‘watching movie’,
‘2:00am’ => ‘typing on tumblr’,
‘2:05am’ => ‘thinking he really should have kept sleeping”
);
function sleep($time){
if(is_array($time)){
foreach($time as $k => $v){
$sleep_schedule .= “It is ” . $k . ” and I am: ” . $v . “<br />\n”;
}
}
return $sleep_schedule;
}
print sleep($time);
?>
<?php
function touch($this){
$stop = 24;
$hammer = 20;
for($you=0;$you < $this;$you++){
if($you == $hammer){
break; // it down
}
}
return $stop . ($hammer + time());
}
?>