Exemple #1
0
     }
 }
 $log_id = $row['log_id'];
 $day = date('D d', $row['login']);
 $login = date('H:i:s', $row['login']);
 $logout = date('H:i:s', $row['logout']);
 $work = calculate_work($login, $logout);
 # $pending = calculate_work($work, $totalperday);
 if ((int) $row['extras'] > 0) {
     $extras = date('H:i:s', $row['extras']);
     $work = calculate_sum($work, $extras);
 } else {
     $extras = '00:00:00';
 }
 $color = calculate_color($work, $hours);
 $total = calculate_sum($total, $work);
 #
 # Faltan los dias que no van listados, por eso genera mal el
 # total pendiente.
 #
 # if ( doubleval( str_replace(':', '', $pending) ) < 0 )
 #     $total_pendding = calculate_work( str_replace('-', '0', $pending), $total_pendding );
 # else
 #     $total_pendding = calculate_sum($total_pendding, $pending);
 $actions = array();
 if ($username == 'joksnet') {
     $actions[] = '<a href="?q=log&amp;a=plus&amp;lid=' . $log_id . '&amp;m=' . $m . '&amp;Y=' . $Y . '&amp;uid=' . $cu . '">more</a>';
     $actions[] = '<a href="?q=log&amp;a=minus&amp;lid=' . $log_id . '&amp;m=' . $m . '&amp;Y=' . $Y . '&amp;uid=' . $cu . '">less</a>';
     $actions[] = '<a href="?q=log&amp;a=complete&amp;lid=' . $log_id . '&amp;m=' . $m . '&amp;Y=' . $Y . '&amp;uid=' . $cu . '">complete</a>';
 }
 $actions_string = implode(' | ', $actions);
Exemple #2
0
    $sum = $x + $y;
    return $sum;
}
// using global variables in functions
function use_variable()
{
    global $some_var;
    echo $some_var;
}
greetings();
// calling a function
echo '<br/>';
echo '<br/>';
greetings_to('John Doe');
// calling function with args
echo '<br/>';
echo '<br/>';
say_hello_to('Jane Doe');
echo '<br/>';
echo '<br/>';
echo calculate_sum(15, 68);
echo '<br/>';
echo '<br/>';
echo calculate_sum();
echo '<br/>';
echo '<br/>';
echo use_variable();
?>

</body>
</html>