Как мы жили без этой функции…

php… ну вы поняли.

Here is a simple function to make positives to negative and negatives to positive. This is function:

<?php
function turn($x)
{
$y = abs($x);
if ($y == $x)
return "-$y";
else
return "$y";
}
?>

You can use this code:

<?php
echo turn(-5) + turn(10);
?>

The output is:

-5

;
Because 5 + -10 = -10

Да-да, 5 + -10 = -10, там так написано. Но вся функция -характерный пример code_wtf.

Отсюда

via

This entry was posted in Uncategorized and tagged . Bookmark the permalink.

Leave a Reply