- 1
- 2
- 3
- 4
- 5
if (count($items) > 100) {
for ($i = count($items); 100 < count($items); $i--) {
unset($items[$i-1]);
}
}
Нашли или выдавили из себя код, который нельзя назвать нормальным, на который без улыбки не взглянешь? Не торопитесь его удалять или рефакторить, — запостите его на говнокод.ру, посмеёмся вместе!
+151
if (count($items) > 100) {
for ($i = count($items); 100 < count($items); $i--) {
unset($items[$i-1]);
}
}
Массив должен содержать сто или меньше элементов
+148
if(!empty($_POST['Order']['tp1'])) {
$step3_arr['tp1'] = intval($_POST['Order']['tp1']);
}
if(!empty($_POST['Order']['tp2'])) {
$step3_arr['tp2'] = intval($_POST['Order']['tp2']);
}
if(!empty($_POST['Order']['tp3'])) {
$step3_arr['tp3'] = intval($_POST['Order']['tp3']);
}
if(!empty($_POST['Order']['tp4'])) {
$step3_arr['tp4'] = intval($_POST['Order']['tp4']);
}
if(!empty($_POST['Order']['eggs1'])) {
$step3_arr['eggs1'] = intval($_POST['Order']['eggs1']);
}
if(!empty($_POST['Order']['eggs2'])) {
$step3_arr['eggs2'] = intval($_POST['Order']['eggs2']);
}
if(!empty($_POST['Order']['eggs3'])) {
$step3_arr['eggs3'] = intval($_POST['Order']['eggs3']);
}
if(!empty($_POST['Order']['eggs4'])) {
$step3_arr['eggs4'] = intval($_POST['Order']['eggs4']);
}
Форма заказа. это только часть длинного листинга if-ов :).
+15
for(std::list<Eff_t*>::iterator i = m_effects.begin(); i != m_effects.end(); ++i)
{
Rot3DEff_t* pRot3DEff = dynamic_cast<Rot3DEff_t*>(*i);
//иначе вместо деструктра Rot3DEff_t вызывается деструктор Eff_t
//если этого не делать не освободится текстура m_pText класса Rot3DEff_t
if (pRot3DEff)
delete pRot3DEff;
else
delete *i;
}
+146
switch($k) {
default: { // Вот так поворот О_о, пацаны, я сам в шоке!
$ret->$k = $v;
}
}
снова мое.
+158
($property['valid'] == 'ошибка') !== TRUE
вот и бери стажеров на работу
+150
<?php
class autoLoad
{
const dir = 'class';
const ext = '.php';
private static $class;
public static function load($class)
{
self::$class = $class;
include self::dir . DIRECTORY_SEPARATOR . self::$class . self::ext;
}
}
spl_autoload_register(array('autoload', 'load'));
нашел лаадер
+111
public static void kk(int KEY, int[] Q, ref int x)
{
if (KEY <= Q[4095]) // 0-4095
{
if (KEY <= Q[2047]) // 0-2047
{
if (KEY <= Q[1023]) // 0-1023
{
if (KEY <= Q[511]) // 0-511
{
if (KEY <= Q[255]) // 0-255
{
if (KEY <= Q[127]) // 0-127
{
if (KEY <= Q[63]) // 0-63
{
if (KEY <= Q[31]) // 0-31
{
if (KEY <= Q[15]) // 0-15
{
if (KEY <= Q[7]) // 0-7
{
if (KEY <= Q[3]) // 0-3
{
if (KEY <= Q[1]) // 0-1
{
if (KEY <= Q[0]) x = 0;
else x = 1;
} // end 0-1
else //2-3
{
if (KEY <= Q[2]) x = 2;
else x = 3;
} // end 2-3
} // end 0-3
.................................................................
С форума sql.ru: "......есть адский статический метод на 33.000 строк...."
−116
_itemList.splice(0, uint.MAX_VALUE);
_amuletList.splice(0, uint.MAX_VALUE);
_timeArtefactList.splice(0, uint.MAX_VALUE);
+100
int i = 0;
foreach (SomeType item in someCollection)
{
if (i > 0) break;
// ... обрабатываем item
}
Берём первый элемент коллекции и обрабатываем...
+159
if (!is_array($array)) {$array = array($array)}