|
Post by Jacob on Jun 12, 2009 14:33:14 GMT -5
Math:
<?php function distance($x1, $y1, $x2, $y2) { $x = pow($y2 - $y1, 2); $y = pow($x2 - $x1, 2); $distance = sqrt($x + $y); return $distance; } function midpoint($x1, $y1, $x2, $y2) { $x = ($x1 + $x2)/2; $y = ($y1 + $y2)/2; $midpoint = $x + $y; return $midpoint; } function calculate($equation) { $equation = ereg_replace('([A-Z]|[a-z])', '', $equation); $answer = eval('return '.$equation.';'); return $answer; } ?>
Text:
<?php function alternating_caps($text) { $x = 1; for($i = 0; $i < strlen($text); $i++) { if($x == 1) { $text{$i} = strtoupper($text{$i}); $x = 2; } elseif($x == 2) { $x = 1; } } return $text; } function random_caps($text) { for($i = 0; $i < strlen($text); $i++) { $x = round(rand(0, 1)); if($x == 1) { $text{$i} = strtoupper($text{$i}); } elseif($x == 2) { } } return $text; }
|
|