About

User

You are logged in as Anonymous.

Want to log out?

To All:

But especially [url=http://shiflett.org/archive/180]Chris[/url]:

[php]

$constants = array(
'F/a' => 'mass', // http://en.wikipedia.org/wiki/Newton%27s_laws_of_motion#Newton.27s_second_law:_fundamental_law_of_dynamics
'783487' => 'y', // arbitrary number
's' => 'preg_replace', // perl )-:
2.71828 => 'e', // http://en.wikipedia.org/wiki/E_%28mathematical_constant%29
'x' => '278127', // arbitrary number
'278127' =>'Christ', // http://en.wikipedia.org/wiki/%CE%A7
'y' => '783487',
);

$formula = array(
'M',
2.71828,
'r', /* pow(r, 2) */
'r', /* = r*r = rr */
( pow((1/$constants['y']), -1) ),
"\n",
sqrt(pow($constants['x'], 2)),
$constants['F/a'], // force = F; acceleration = a
"\n",
's/ss/s'
);
$adjust = array_pop($formula);

$message = '';
foreach ($formula AS $p) {
if (isset($constants[$p])) {
$message .= $constants[$p];
} else {
$message .= $p;
}
}

list($func, $regex, $replace) = explode('/', $adjust);

$message = call_user_func($constants[$func],"/{$regex}/","{$replace}", $message);

echo $message;

?>[/php]


1 Responses to To All:

  1. 184 Chris Shiflett 2005-12-23 13:04

    Hey, that's not necessarily Perl. I was thinking of vi, actually. :-)

    (I guess hardcore geeks first think of sed.)

Leave a Reply




Clicky Web Analytics