aguz99

functions.php

Aug 1st, 2018
43
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.67 KB | None | 0 0
  1. <?php
  2. /**
  3. * AGUS SUPRIYATNA
  4. * CUSTOM FUNCTION
  5. **/
  6. # Print New Line
  7. function br()
  8. {
  9.     echo"<br>";
  10. }
  11.  
  12. ## TABLE function
  13. # table open
  14. function table_o()
  15. {
  16.     echo "<table>";
  17. }
  18. # table close
  19. function table_c()
  20. {
  21.     echo "</table>";
  22. }
  23. # tr open
  24. function tr_o()
  25. {
  26.     echo "<tr>";
  27. }
  28. # tr close
  29. function tr_c()
  30. {
  31.     echo "</tr>";
  32. }
  33. # td
  34. function td($a="")
  35. {
  36.     echo "<td>$a</td>";
  37. }
  38.  
  39. # fibonacci
  40. function fib($i)
  41. {
  42.     if ($i==1 || $i==2) {
  43.         return 1;
  44.     } else {
  45.         return fib($i-1)+fib($i-2);
  46.     }
  47. }
  48.  
  49. # ganjil
  50. function ganjil($i)
  51. {
  52.     return $i*2-1;
  53. }
  54.  
  55. # gap
  56. function gap($i)
  57. {
  58.     return $i*($i+1)/2;
  59. }
  60. # pyramid total
  61. function pytot($i)
  62. {
  63.     return $i*$i;
  64. }
Add Comment
Please, Sign In to add comment