November 2019

S M T W T F S
      12
34 5 678 9
10111213141516
17181920212223
24252627282930

Style Credit

Expand Cut Tags

No cut tags
Tuesday, December 22nd, 2009 10:07 pm

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

Оригинал этой записи. Комментировать можно тут или там.

Любые материалы из этого блога запрещается использовать на сайте livejournal.ru в любой форме и любом объёме

Reply

This account has disabled anonymous posting.
If you don't have an account you can create one now.
HTML doesn't work in the subject.
More info about formatting