3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php final class HijriBirthday { public function convertSolarToLunar($year, $month, $date) { return HijriConverter::gregorianToHijri($year, $month, $date); } } class HijriConverter { public function intPart($float) { if ($float < -0.0000001) { return ceil($float - 0.0000001); } return floor($float + 0.0000001); } public function gregorianToHijri($y, $m, $d) { if ($y > 1700) { if (($y > 1582) || (($y == 1582) && ($m > 10)) || (($y == 1582) && ($m == 10) && ($d > 14))) { $jd = self::intPart( (1461 * ($y + 4800 + self::intPart(($m - 14) / 12))) / 4 ) + self::intPart( (367 * ($m - 2 - 12 * (self::intPart(($m - 14) / 12)))) / 12 ) - self::intPart((3 * ( self::intPart(($y + 4900 + self::intPart(($m - 14) / 12)) / 100) )) / 4) + $d - 32075; } else { $jd = 367 * $y - self::intPart( (7 * ($y + 5001 + self::intPart(($m - 9) / 7))) / 4 ) + self::intPart((275 * $m) / 9) + $d + 1729777; } $l = $jd - 1948440 + 10632; $n = self::intPart(($l - 1) / 10631); $l = $l - 10631 * $n + 354; $j = (self::intPart((10985 - $l) / 5316)) * (self::intPart(( 50 * $l) / 17719)) + (self::intPart($l / 5670)) * (self::intPart((43 * $l) / 15238)); $l = $l - (self::intPart((30 - $j) / 15)) * (self::intPart((17719 * $j) / 50)) - (self::intPart($j / 16)) * (self::intPart((15238 * $j) / 43)) + 29; $m = self::intPart((24 * $l) / 709); $d = $l - self::intPart((709 * $m) / 24); $y = 30 * $n + $j - 30; if ($d < 10) $d = "0".$d; if ($m < 10) $m = "0".$m; return array($y, $m, $d); } return array(); } } function main() { var_dump((new HijriBirthday)->convertSolarToLunar(1983, (double)31, 7)); var_dump((new HijriBirthday)->convertSolarToLunar(1983, (double)31, 7)); var_dump((new HijriBirthday)->convertSolarToLunar(1983, (double)31, 7)); } main(); echo "done\n";
based on jkEJU
Output for 7.0.0 - 7.1.0
Deprecated: Non-static method HijriConverter::gregorianToHijri() should not be called statically in /in/Ythek on line 5 Deprecated: Non-static method HijriConverter::intPart() should not be called statically in /in/Ythek on line 22 Deprecated: Non-static method HijriConverter::intPart() should not be called statically in /in/Ythek on line 23 Deprecated: Non-static method HijriConverter::intPart() should not be called statically in /in/Ythek on line 24 Deprecated: Non-static method HijriConverter::intPart() should not be called statically in /in/Ythek on line 25 Deprecated: Non-static method HijriConverter::intPart() should not be called statically in /in/Ythek on line 26 Deprecated: Non-static method HijriConverter::intPart() should not be called statically in /in/Ythek on line 27 Deprecated: Non-static method HijriConverter::intPart() should not be called statically in /in/Ythek on line 27 Deprecated: Non-static method HijriConverter::intPart() should not be called statically in /in/Ythek on line 36 Deprecated: Non-static method HijriConverter::intPart() should not be called statically in /in/Ythek on line 38 Deprecated: Non-static method HijriConverter::intPart() should not be called statically in /in/Ythek on line 39 Deprecated: Non-static method HijriConverter::intPart() should not be called statically in /in/Ythek on line 40 Deprecated: Non-static method HijriConverter::intPart() should not be called statically in /in/Ythek on line 40 Deprecated: Non-static method HijriConverter::intPart() should not be called statically in /in/Ythek on line 41 Deprecated: Non-static method HijriConverter::intPart() should not be called statically in /in/Ythek on line 42 Deprecated: Non-static method HijriConverter::intPart() should not be called statically in /in/Ythek on line 43 Deprecated: Non-static method HijriConverter::intPart() should not be called statically in /in/Ythek on line 43 Deprecated: Non-static method HijriConverter::intPart() should not be called statically in /in/Ythek on line 44 Deprecated: Non-static method HijriConverter::intPart() should not be called statically in /in/Ythek on line 45 array(3) { [0]=> float(1405) [1]=> float(10) [2]=> float(20) } Deprecated: Non-static method HijriConverter::gregorianToHijri() should not be called statically in /in/Ythek on line 5 Deprecated: Non-static method HijriConverter::intPart() should not be called statically in /in/Ythek on line 22 Deprecated: Non-static method HijriConverter::intPart() should not be called statically in /in/Ythek on line 23 Deprecated: Non-static method HijriConverter::intPart() should not be called statically in /in/Ythek on line 24 Deprecated: Non-static method HijriConverter::intPart() should not be called statically in /in/Ythek on line 25 Deprecated: Non-static method HijriConverter::intPart() should not be called statically in /in/Ythek on line 26 Deprecated: Non-static method HijriConverter::intPart() should not be called statically in /in/Ythek on line 27 Deprecated: Non-static method HijriConverter::intPart() should not be called statically in /in/Ythek on line 27 Deprecated: Non-static method HijriConverter::intPart() should not be called statically in /in/Ythek on line 36 Deprecated: Non-static method HijriConverter::intPart() should not be called statically in /in/Ythek on line 38 Deprecated: Non-static method HijriConverter::intPart() should not be called statically in /in/Ythek on line 39 Deprecated: Non-static method HijriConverter::intPart() should not be called statically in /in/Ythek on line 40 Deprecated: Non-static method HijriConverter::intPart() should not be called statically in /in/Ythek on line 40 Deprecated: Non-static method HijriConverter::intPart() should not be called statically in /in/Ythek on line 41 Deprecated: Non-static method HijriConverter::intPart() should not be called statically in /in/Ythek on line 42 Deprecated: Non-static method HijriConverter::intPart() should not be called statically in /in/Ythek on line 43 Deprecated: Non-static method HijriConverter::intPart() should not be called statically in /in/Ythek on line 43 Deprecated: Non-static method HijriConverter::intPart() should not be called statically in /in/Ythek on line 44 Deprecated: Non-static method HijriConverter::intPart() should not be called statically in /in/Ythek on line 45 array(3) { [0]=> float(1405) [1]=> float(10) [2]=> float(20) } Deprecated: Non-static method HijriConverter::gregorianToHijri() should not be called statically in /in/Ythek on line 5 Deprecated: Non-static method HijriConverter::intPart() should not be called statically in /in/Ythek on line 22 Deprecated: Non-static method HijriConverter::intPart() should not be called statically in /in/Ythek on line 23 Deprecated: Non-static method HijriConverter::intPart() should not be called statically in /in/Ythek on line 24 Deprecated: Non-static method HijriConverter::intPart() should not be called statically in /in/Ythek on line 25 Deprecated: Non-static method HijriConverter::intPart() should not be called statically in /in/Ythek on line 26 Deprecated: Non-static method HijriConverter::intPart() should not be called statically in /in/Ythek on line 27 Deprecated: Non-static method HijriConverter::intPart() should not be called statically in /in/Ythek on line 27 Deprecated: Non-static method HijriConverter::intPart() should not be called statically in /in/Ythek on line 36 Deprecated: Non-static method HijriConverter::intPart() should not be called statically in /in/Ythek on line 38 Deprecated: Non-static method HijriConverter::intPart() should not be called statically in /in/Ythek on line 39 Deprecated: Non-static method HijriConverter::intPart() should not be called statically in /in/Ythek on line 40 Deprecated: Non-static method HijriConverter::intPart() should not be called statically in /in/Ythek on line 40 Deprecated: Non-static method HijriConverter::intPart() should not be called statically in /in/Ythek on line 41 Deprecated: Non-static method HijriConverter::intPart() should not be called statically in /in/Ythek on line 42 Deprecated: Non-static method HijriConverter::intPart() should not be called statically in /in/Ythek on line 43 Deprecated: Non-static method HijriConverter::intPart() should not be called statically in /in/Ythek on line 43 Deprecated: Non-static method HijriConverter::intPart() should not be called statically in /in/Ythek on line 44 Deprecated: Non-static method HijriConverter::intPart() should not be called statically in /in/Ythek on line 45 array(3) { [0]=> float(1405) [1]=> float(10) [2]=> float(20) } done
Output for hhvm-3.10.0 - 3.12.0
array(3) { [0]=> float(1405) [1]=> float(10) [2]=> float(20) } array(3) { [0]=> float(1405) [1]=> float(10) [2]=> float(20) } array(3) { [0]=> float(1405) [1]=> float(10) [2]=> float(20) } done
Output for 5.6.7 - 5.6.28
Deprecated: Non-static method HijriConverter::gregorianToHijri() should not be called statically, assuming $this from incompatible context in /in/Ythek on line 5 Deprecated: Non-static method HijriConverter::intPart() should not be called statically, assuming $this from incompatible context in /in/Ythek on line 22 Deprecated: Non-static method HijriConverter::intPart() should not be called statically, assuming $this from incompatible context in /in/Ythek on line 23 Deprecated: Non-static method HijriConverter::intPart() should not be called statically, assuming $this from incompatible context in /in/Ythek on line 24 Deprecated: Non-static method HijriConverter::intPart() should not be called statically, assuming $this from incompatible context in /in/Ythek on line 25 Deprecated: Non-static method HijriConverter::intPart() should not be called statically, assuming $this from incompatible context in /in/Ythek on line 26 Deprecated: Non-static method HijriConverter::intPart() should not be called statically, assuming $this from incompatible context in /in/Ythek on line 27 Deprecated: Non-static method HijriConverter::intPart() should not be called statically, assuming $this from incompatible context in /in/Ythek on line 27 Deprecated: Non-static method HijriConverter::intPart() should not be called statically, assuming $this from incompatible context in /in/Ythek on line 36 Deprecated: Non-static method HijriConverter::intPart() should not be called statically, assuming $this from incompatible context in /in/Ythek on line 38 Deprecated: Non-static method HijriConverter::intPart() should not be called statically, assuming $this from incompatible context in /in/Ythek on line 39 Deprecated: Non-static method HijriConverter::intPart() should not be called statically, assuming $this from incompatible context in /in/Ythek on line 40 Deprecated: Non-static method HijriConverter::intPart() should not be called statically, assuming $this from incompatible context in /in/Ythek on line 40 Deprecated: Non-static method HijriConverter::intPart() should not be called statically, assuming $this from incompatible context in /in/Ythek on line 41 Deprecated: Non-static method HijriConverter::intPart() should not be called statically, assuming $this from incompatible context in /in/Ythek on line 42 Deprecated: Non-static method HijriConverter::intPart() should not be called statically, assuming $this from incompatible context in /in/Ythek on line 43 Deprecated: Non-static method HijriConverter::intPart() should not be called statically, assuming $this from incompatible context in /in/Ythek on line 43 Deprecated: Non-static method HijriConverter::intPart() should not be called statically, assuming $this from incompatible context in /in/Ythek on line 44 Deprecated: Non-static method HijriConverter::intPart() should not be called statically, assuming $this from incompatible context in /in/Ythek on line 45 array(3) { [0]=> float(1405) [1]=> float(10) [2]=> float(20) } Deprecated: Non-static method HijriConverter::gregorianToHijri() should not be called statically, assuming $this from incompatible context in /in/Ythek on line 5 Deprecated: Non-static method HijriConverter::intPart() should not be called statically, assuming $this from incompatible context in /in/Ythek on line 22 Deprecated: Non-static method HijriConverter::intPart() should not be called statically, assuming $this from incompatible context in /in/Ythek on line 23 Deprecated: Non-static method HijriConverter::intPart() should not be called statically, assuming $this from incompatible context in /in/Ythek on line 24 Deprecated: Non-static method HijriConverter::intPart() should not be called statically, assuming $this from incompatible context in /in/Ythek on line 25 Deprecated: Non-static method HijriConverter::intPart() should not be called statically, assuming $this from incompatible context in /in/Ythek on line 26 Deprecated: Non-static method HijriConverter::intPart() should not be called statically, assuming $this from incompatible context in /in/Ythek on line 27 Deprecated: Non-static method HijriConverter::intPart() should not be called statically, assuming $this from incompatible context in /in/Ythek on line 27 Deprecated: Non-static method HijriConverter::intPart() should not be called statically, assuming $this from incompatible context in /in/Ythek on line 36 Deprecated: Non-static method HijriConverter::intPart() should not be called statically, assuming $this from incompatible context in /in/Ythek on line 38 Deprecated: Non-static method HijriConverter::intPart() should not be called statically, assuming $this from incompatible context in /in/Ythek on line 39 Deprecated: Non-static method HijriConverter::intPart() should not be called statically, assuming $this from incompatible context in /in/Ythek on line 40 Deprecated: Non-static method HijriConverter::intPart() should not be called statically, assuming $this from incompatible context in /in/Ythek on line 40 Deprecated: Non-static method HijriConverter::intPart() should not be called statically, assuming $this from incompatible context in /in/Ythek on line 41 Deprecated: Non-static method HijriConverter::intPart() should not be called statically, assuming $this from incompatible context in /in/Ythek on line 42 Deprecated: Non-static method HijriConverter::intPart() should not be called statically, assuming $this from incompatible context in /in/Ythek on line 43 Deprecated: Non-static method HijriConverter::intPart() should not be called statically, assuming $this from incompatible context in /in/Ythek on line 43 Deprecated: Non-static method HijriConverter::intPart() should not be called statically, assuming $this from incompatible context in /in/Ythek on line 44 Deprecated: Non-static method HijriConverter::intPart() should not be called statically, assuming $this from incompatible context in /in/Ythek on line 45 array(3) { [0]=> float(1405) [1]=> float(10) [2]=> float(20) } Deprecated: Non-static method HijriConverter::gregorianToHijri() should not be called statically, assuming $this from incompatible context in /in/Ythek on line 5 Deprecated: Non-static method HijriConverter::intPart() should not be called statically, assuming $this from incompatible context in /in/Ythek on line 22 Deprecated: Non-static method HijriConverter::intPart() should not be called statically, assuming $this from incompatible context in /in/Ythek on line 23 Deprecated: Non-static method HijriConverter::intPart() should not be called statically, assuming $this from incompatible context in /in/Ythek on line 24 Deprecated: Non-static method HijriConverter::intPart() should not be called statically, assuming $this from incompatible context in /in/Ythek on line 25 Deprecated: Non-static method HijriConverter::intPart() should not be called statically, assuming $this from incompatible context in /in/Ythek on line 26 Deprecated: Non-static method HijriConverter::intPart() should not be called statically, assuming $this from incompatible context in /in/Ythek on line 27 Deprecated: Non-static method HijriConverter::intPart() should not be called statically, assuming $this from incompatible context in /in/Ythek on line 27 Deprecated: Non-static method HijriConverter::intPart() should not be called statically, assuming $this from incompatible context in /in/Ythek on line 36 Deprecated: Non-static method HijriConverter::intPart() should not be called statically, assuming $this from incompatible context in /in/Ythek on line 38 Deprecated: Non-static method HijriConverter::intPart() should not be called statically, assuming $this from incompatible context in /in/Ythek on line 39 Deprecated: Non-static method HijriConverter::intPart() should not be called statically, assuming $this from incompatible context in /in/Ythek on line 40 Deprecated: Non-static method HijriConverter::intPart() should not be called statically, assuming $this from incompatible context in /in/Ythek on line 40 Deprecated: Non-static method HijriConverter::intPart() should not be called statically, assuming $this from incompatible context in /in/Ythek on line 41 Deprecated: Non-static method HijriConverter::intPart() should not be called statically, assuming $this from incompatible context in /in/Ythek on line 42 Deprecated: Non-static method HijriConverter::intPart() should not be called statically, assuming $this from incompatible context in /in/Ythek on line 43 Deprecated: Non-static method HijriConverter::intPart() should not be called statically, assuming $this from incompatible context in /in/Ythek on line 43 Deprecated: Non-static method HijriConverter::intPart() should not be called statically, assuming $this from incompatible context in /in/Ythek on line 44 Deprecated: Non-static method HijriConverter::intPart() should not be called statically, assuming $this from incompatible context in /in/Ythek on line 45 array(3) { [0]=> float(1405) [1]=> float(10) [2]=> float(20) } done
Output for 5.4.0 - 5.5.35
Strict Standards: Non-static method HijriConverter::gregorianToHijri() should not be called statically, assuming $this from incompatible context in /in/Ythek on line 5 Strict Standards: Non-static method HijriConverter::intPart() should not be called statically, assuming $this from incompatible context in /in/Ythek on line 22 Strict Standards: Non-static method HijriConverter::intPart() should not be called statically, assuming $this from incompatible context in /in/Ythek on line 23 Strict Standards: Non-static method HijriConverter::intPart() should not be called statically, assuming $this from incompatible context in /in/Ythek on line 24 Strict Standards: Non-static method HijriConverter::intPart() should not be called statically, assuming $this from incompatible context in /in/Ythek on line 25 Strict Standards: Non-static method HijriConverter::intPart() should not be called statically, assuming $this from incompatible context in /in/Ythek on line 26 Strict Standards: Non-static method HijriConverter::intPart() should not be called statically, assuming $this from incompatible context in /in/Ythek on line 27 Strict Standards: Non-static method HijriConverter::intPart() should not be called statically, assuming $this from incompatible context in /in/Ythek on line 27 Strict Standards: Non-static method HijriConverter::intPart() should not be called statically, assuming $this from incompatible context in /in/Ythek on line 36 Strict Standards: Non-static method HijriConverter::intPart() should not be called statically, assuming $this from incompatible context in /in/Ythek on line 38 Strict Standards: Non-static method HijriConverter::intPart() should not be called statically, assuming $this from incompatible context in /in/Ythek on line 39 Strict Standards: Non-static method HijriConverter::intPart() should not be called statically, assuming $this from incompatible context in /in/Ythek on line 40 Strict Standards: Non-static method HijriConverter::intPart() should not be called statically, assuming $this from incompatible context in /in/Ythek on line 40 Strict Standards: Non-static method HijriConverter::intPart() should not be called statically, assuming $this from incompatible context in /in/Ythek on line 41 Strict Standards: Non-static method HijriConverter::intPart() should not be called statically, assuming $this from incompatible context in /in/Ythek on line 42 Strict Standards: Non-static method HijriConverter::intPart() should not be called statically, assuming $this from incompatible context in /in/Ythek on line 43 Strict Standards: Non-static method HijriConverter::intPart() should not be called statically, assuming $this from incompatible context in /in/Ythek on line 43 Strict Standards: Non-static method HijriConverter::intPart() should not be called statically, assuming $this from incompatible context in /in/Ythek on line 44 Strict Standards: Non-static method HijriConverter::intPart() should not be called statically, assuming $this from incompatible context in /in/Ythek on line 45 array(3) { [0]=> float(1405) [1]=> float(10) [2]=> float(20) } Strict Standards: Non-static method HijriConverter::gregorianToHijri() should not be called statically, assuming $this from incompatible context in /in/Ythek on line 5 Strict Standards: Non-static method HijriConverter::intPart() should not be called statically, assuming $this from incompatible context in /in/Ythek on line 22 Strict Standards: Non-static method HijriConverter::intPart() should not be called statically, assuming $this from incompatible context in /in/Ythek on line 23 Strict Standards: Non-static method HijriConverter::intPart() should not be called statically, assuming $this from incompatible context in /in/Ythek on line 24 Strict Standards: Non-static method HijriConverter::intPart() should not be called statically, assuming $this from incompatible context in /in/Ythek on line 25 Strict Standards: Non-static method HijriConverter::intPart() should not be called statically, assuming $this from incompatible context in /in/Ythek on line 26 Strict Standards: Non-static method HijriConverter::intPart() should not be called statically, assuming $this from incompatible context in /in/Ythek on line 27 Strict Standards: Non-static method HijriConverter::intPart() should not be called statically, assuming $this from incompatible context in /in/Ythek on line 27 Strict Standards: Non-static method HijriConverter::intPart() should not be called statically, assuming $this from incompatible context in /in/Ythek on line 36 Strict Standards: Non-static method HijriConverter::intPart() should not be called statically, assuming $this from incompatible context in /in/Ythek on line 38 Strict Standards: Non-static method HijriConverter::intPart() should not be called statically, assuming $this from incompatible context in /in/Ythek on line 39 Strict Standards: Non-static method HijriConverter::intPart() should not be called statically, assuming $this from incompatible context in /in/Ythek on line 40 Strict Standards: Non-static method HijriConverter::intPart() should not be called statically, assuming $this from incompatible context in /in/Ythek on line 40 Strict Standards: Non-static method HijriConverter::intPart() should not be called statically, assuming $this from incompatible context in /in/Ythek on line 41 Strict Standards: Non-static method HijriConverter::intPart() should not be called statically, assuming $this from incompatible context in /in/Ythek on line 42 Strict Standards: Non-static method HijriConverter::intPart() should not be called statically, assuming $this from incompatible context in /in/Ythek on line 43 Strict Standards: Non-static method HijriConverter::intPart() should not be called statically, assuming $this from incompatible context in /in/Ythek on line 43 Strict Standards: Non-static method HijriConverter::intPart() should not be called statically, assuming $this from incompatible context in /in/Ythek on line 44 Strict Standards: Non-static method HijriConverter::intPart() should not be called statically, assuming $this from incompatible context in /in/Ythek on line 45 array(3) { [0]=> float(1405) [1]=> float(10) [2]=> float(20) } Strict Standards: Non-static method HijriConverter::gregorianToHijri() should not be called statically, assuming $this from incompatible context in /in/Ythek on line 5 Strict Standards: Non-static method HijriConverter::intPart() should not be called statically, assuming $this from incompatible context in /in/Ythek on line 22 Strict Standards: Non-static method HijriConverter::intPart() should not be called statically, assuming $this from incompatible context in /in/Ythek on line 23 Strict Standards: Non-static method HijriConverter::intPart() should not be called statically, assuming $this from incompatible context in /in/Ythek on line 24 Strict Standards: Non-static method HijriConverter::intPart() should not be called statically, assuming $this from incompatible context in /in/Ythek on line 25 Strict Standards: Non-static method HijriConverter::intPart() should not be called statically, assuming $this from incompatible context in /in/Ythek on line 26 Strict Standards: Non-static method HijriConverter::intPart() should not be called statically, assuming $this from incompatible context in /in/Ythek on line 27 Strict Standards: Non-static method HijriConverter::intPart() should not be called statically, assuming $this from incompatible context in /in/Ythek on line 27 Strict Standards: Non-static method HijriConverter::intPart() should not be called statically, assuming $this from incompatible context in /in/Ythek on line 36 Strict Standards: Non-static method HijriConverter::intPart() should not be called statically, assuming $this from incompatible context in /in/Ythek on line 38 Strict Standards: Non-static method HijriConverter::intPart() should not be called statically, assuming $this from incompatible context in /in/Ythek on line 39 Strict Standards: Non-static method HijriConverter::intPart() should not be called statically, assuming $this from incompatible context in /in/Ythek on line 40 Strict Standards: Non-static method HijriConverter::intPart() should not be called statically, assuming $this from incompatible context in /in/Ythek on line 40 Strict Standards: Non-static method HijriConverter::intPart() should not be called statically, assuming $this from incompatible context in /in/Ythek on line 41 Strict Standards: Non-static method HijriConverter::intPart() should not be called statically, assuming $this from incompatible context in /in/Ythek on line 42 Strict Standards: Non-static method HijriConverter::intPart() should not be called statically, assuming $this from incompatible context in /in/Ythek on line 43 Strict Standards: Non-static method HijriConverter::intPart() should not be called statically, assuming $this from incompatible context in /in/Ythek on line 43 Strict Standards: Non-static method HijriConverter::intPart() should not be called statically, assuming $this from incompatible context in /in/Ythek on line 44 Strict Standards: Non-static method HijriConverter::intPart() should not be called statically, assuming $this from incompatible context in /in/Ythek on line 45 array(3) { [0]=> float(1405) [1]=> float(10) [2]=> float(20) } done
Output for 5.1.0 - 5.3.29
Parse error: syntax error, unexpected T_OBJECT_OPERATOR in /in/Ythek on line 61
Process exited with code 255.
Output for 5.0.0 - 5.0.5
Parse error: parse error, unexpected T_OBJECT_OPERATOR in /in/Ythek on line 61
Process exited with code 255.
Output for 4.4.2 - 4.4.9
Parse error: syntax error, unexpected T_CLASS in /in/Ythek on line 3
Process exited with code 255.
Output for 4.3.0 - 4.3.1, 4.3.5 - 4.4.1
Parse error: parse error, unexpected T_CLASS in /in/Ythek on line 3
Process exited with code 255.
Output for 4.3.2 - 4.3.4
Parse error: parse error in /in/Ythek on line 3
Process exited with code 255.