math.test 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187
  1. Mathematical operators
  2. -----
  3. <?php
  4. // unary ops
  5. ~$a;
  6. +$a;
  7. -$a;
  8. // binary ops
  9. $a & $b;
  10. $a | $b;
  11. $a ^ $b;
  12. $a . $b;
  13. $a / $b;
  14. $a - $b;
  15. $a % $b;
  16. $a * $b;
  17. $a + $b;
  18. $a << $b;
  19. $a >> $b;
  20. // associativity
  21. $a * $b * $c;
  22. $a * ($b * $c);
  23. // precedence
  24. $a + $b * $c;
  25. ($a + $b) * $c;
  26. -----
  27. array(
  28. 0: Expr_BitwiseNot(
  29. expr: Expr_Variable(
  30. name: a
  31. )
  32. )
  33. 1: Expr_UnaryPlus(
  34. expr: Expr_Variable(
  35. name: a
  36. )
  37. )
  38. 2: Expr_UnaryMinus(
  39. expr: Expr_Variable(
  40. name: a
  41. )
  42. )
  43. 3: Expr_BitwiseAnd(
  44. left: Expr_Variable(
  45. name: a
  46. )
  47. right: Expr_Variable(
  48. name: b
  49. )
  50. )
  51. 4: Expr_BitwiseOr(
  52. left: Expr_Variable(
  53. name: a
  54. )
  55. right: Expr_Variable(
  56. name: b
  57. )
  58. )
  59. 5: Expr_BitwiseXor(
  60. left: Expr_Variable(
  61. name: a
  62. )
  63. right: Expr_Variable(
  64. name: b
  65. )
  66. )
  67. 6: Expr_Concat(
  68. left: Expr_Variable(
  69. name: a
  70. )
  71. right: Expr_Variable(
  72. name: b
  73. )
  74. )
  75. 7: Expr_Div(
  76. left: Expr_Variable(
  77. name: a
  78. )
  79. right: Expr_Variable(
  80. name: b
  81. )
  82. )
  83. 8: Expr_Minus(
  84. left: Expr_Variable(
  85. name: a
  86. )
  87. right: Expr_Variable(
  88. name: b
  89. )
  90. )
  91. 9: Expr_Mod(
  92. left: Expr_Variable(
  93. name: a
  94. )
  95. right: Expr_Variable(
  96. name: b
  97. )
  98. )
  99. 10: Expr_Mul(
  100. left: Expr_Variable(
  101. name: a
  102. )
  103. right: Expr_Variable(
  104. name: b
  105. )
  106. )
  107. 11: Expr_Plus(
  108. left: Expr_Variable(
  109. name: a
  110. )
  111. right: Expr_Variable(
  112. name: b
  113. )
  114. )
  115. 12: Expr_ShiftLeft(
  116. left: Expr_Variable(
  117. name: a
  118. )
  119. right: Expr_Variable(
  120. name: b
  121. )
  122. )
  123. 13: Expr_ShiftRight(
  124. left: Expr_Variable(
  125. name: a
  126. )
  127. right: Expr_Variable(
  128. name: b
  129. )
  130. )
  131. 14: Expr_Mul(
  132. left: Expr_Mul(
  133. left: Expr_Variable(
  134. name: a
  135. )
  136. right: Expr_Variable(
  137. name: b
  138. )
  139. )
  140. right: Expr_Variable(
  141. name: c
  142. )
  143. )
  144. 15: Expr_Mul(
  145. left: Expr_Variable(
  146. name: a
  147. )
  148. right: Expr_Mul(
  149. left: Expr_Variable(
  150. name: b
  151. )
  152. right: Expr_Variable(
  153. name: c
  154. )
  155. )
  156. )
  157. 16: Expr_Plus(
  158. left: Expr_Variable(
  159. name: a
  160. )
  161. right: Expr_Mul(
  162. left: Expr_Variable(
  163. name: b
  164. )
  165. right: Expr_Variable(
  166. name: c
  167. )
  168. )
  169. )
  170. 17: Expr_Mul(
  171. left: Expr_Plus(
  172. left: Expr_Variable(
  173. name: a
  174. )
  175. right: Expr_Variable(
  176. name: b
  177. )
  178. )
  179. right: Expr_Variable(
  180. name: c
  181. )
  182. )
  183. )