3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $logfile = fopen('/tmp/out', 'w+'); function test($logfile) { $chars = '0123456789abcdefghijklmnopqrstuvwxyz'; $base = mt_rand(2, 36); $len = mt_rand(10, 100); $str = ''; for ($i = 0; $i < $len; ++$i) { $str .= $chars[mt_rand(0, $base - 1)]; } fprintf($logfile, "base %s value %s\n", $base, $str); $gmp = gmp_init($str, $base); $val = gmp_strval($str, $base); $val = str_pad($val, strlen($str), '0', STR_PAD_LEFT); if ($val !== $str) { throw new Exception('Not same - base '.$base."\n-".$str."\n+".$val); } } for($i = 0; $i < 100000; ++$i) { test($logfile); }
Output for 7.1.0
Fatal error: Uncaught Exception: Not same - base 3 -2001021001102100011210112101011012202222020022100010100022201120102000122100211001202001100022 +1211102112211011210011212020220122221122121002200120221211210201000102210220202121000021110202100202020010200110002122002101112011201102212002101211012202100010010211112212010010002022111122012222 in /in/Oo2JU:17 Stack trace: #0 /in/Oo2JU(22): test(Resource id #5) #1 {main} thrown in /in/Oo2JU on line 17
Process exited with code 255.
Output for 7.0.14
Warning: gmp_strval(): Unable to convert variable to GMP - string is not an integer in /in/Oo2JU on line 14 Fatal error: Uncaught Exception: Not same - base 20 -e0j7ag5j4e5i9e4j5h26daj73ca02e7deb1bgbi524e32bd182de3d43b84ieda0jaed2i9f63hj30fah89e4edcj5h +0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 in /in/Oo2JU:17 Stack trace: #0 /in/Oo2JU(22): test(Resource id #5) #1 {main} thrown in /in/Oo2JU on line 17
Process exited with code 255.
Output for 7.0.6
Fatal error: Uncaught Error: Call to undefined function gmp_init() in /in/Oo2JU:13 Stack trace: #0 /in/Oo2JU(22): test(Resource id #5) #1 {main} thrown in /in/Oo2JU on line 13
Process exited with code 255.
Output for 7.0.5
Fatal error: Uncaught Exception: Not same - base 4 -1122021202303130100233311300223130031003212333320333300 +232312321200331313101123210120213230132330202230220330232312122023220102023103310112133310 in /in/Oo2JU:17 Stack trace: #0 /in/Oo2JU(22): test(Resource id #5) #1 {main} thrown in /in/Oo2JU on line 17
Process exited with code 255.
Output for 7.0.4
Warning: gmp_strval(): Unable to convert variable to GMP - string is not an integer in /in/Oo2JU on line 14 Fatal error: Uncaught Exception: Not same - base 12 -368702505a106 +0000000000000 in /in/Oo2JU:17 Stack trace: #0 /in/Oo2JU(22): test(Resource id #5) #1 {main} thrown in /in/Oo2JU on line 17
Process exited with code 255.
Output for 7.0.3
Warning: gmp_strval(): Unable to convert variable to GMP - string is not an integer in /in/Oo2JU on line 14 Fatal error: Uncaught Exception: Not same - base 19 -1617bdaebecg7627b4091f5be81i3cc78ea2ag4475ib5 +000000000000000000000000000000000000000000000 in /in/Oo2JU:17 Stack trace: #0 /in/Oo2JU(22): test(Resource id #5) #1 {main} thrown in /in/Oo2JU on line 17
Process exited with code 255.
Output for 7.0.2
Warning: gmp_strval(): Unable to convert variable to GMP - string is not an integer in /in/Oo2JU on line 14 Fatal error: Uncaught Exception: Not same - base 13 -0b574384c5211a187955a7b26a1a7b011b56180aa3b4976b0294 +0000000000000000000000000000000000000000000000000000 in /in/Oo2JU:17 Stack trace: #0 /in/Oo2JU(22): test(Resource id #5) #1 {main} thrown in /in/Oo2JU on line 17
Process exited with code 255.
Output for 7.0.1
Warning: gmp_strval(): Unable to convert variable to GMP - string is not an integer in /in/Oo2JU on line 14 Fatal error: Uncaught Exception: Not same - base 30 -3g4mhnkeecm22rcfcgas2aolap0q8obgnr +0000000000000000000000000000000000 in /in/Oo2JU:17 Stack trace: #0 /in/Oo2JU(22): test(Resource id #5) #1 {main} thrown in /in/Oo2JU on line 17
Process exited with code 255.
Output for 7.0.0
Warning: gmp_strval(): Unable to convert variable to GMP - string is not an integer in /in/Oo2JU on line 14 Fatal error: Uncaught Exception: Not same - base 33 -8tw114wsmnsv9d7lk3cd1k3wjw3n483hmmw90abdk8n11o0hpk61rrftc17aaagqkl0mk39d5mn78tvg1hq2mee5646g +00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 in /in/Oo2JU:17 Stack trace: #0 /in/Oo2JU(22): test(Resource id #5) #1 {main} thrown in /in/Oo2JU on line 17
Process exited with code 255.
Output for hhvm-3.12.0
Fatal error: Uncaught exception 'Exception' with message 'Not same - base 8 -21602272704 +240746102700' in /in/Oo2JU:17 Stack trace: #0 /in/Oo2JU(22): test() #1 {main}
Process exited with code 255.
Output for hhvm-3.10.0
Warning: gmp_strval(): Unable to convert variable to GMP - string is not an integer in /in/Oo2JU on line 14 Fatal error: Uncaught exception 'Exception' with message 'Not same - base 24 -ncln5f438embj970dkf31j80k9f6l +00000000000000000000000000000' in /in/Oo2JU:17 Stack trace: #0 /in/Oo2JU(22): test() #1 {main}
Process exited with code 255.
Output for 5.6.28
Warning: gmp_strval(): Unable to convert variable to GMP - string is not an integer in /in/Oo2JU on line 14 Fatal error: Uncaught exception 'Exception' with message 'Not same - base 17 -ac18189g4d67f32c0098gg2a368e +0000000000000000000000000000' in /in/Oo2JU:17 Stack trace: #0 /in/Oo2JU(22): test(Resource id #5) #1 {main} thrown in /in/Oo2JU on line 17
Process exited with code 255.
Output for 5.0.0 - 5.4.32, 5.5.35, 5.6.21
Fatal error: Call to undefined function gmp_init() in /in/Oo2JU on line 13
Process exited with code 255.
Output for 5.6.20
Warning: gmp_strval(): Unable to convert variable to GMP - string is not an integer in /in/Oo2JU on line 14 Fatal error: Uncaught exception 'Exception' with message 'Not same - base 15 -5a74c9763c6c9c73969cb376a7c2266b282285caab6499ee71e76983d443da667478a9 +0000000000000000000000000000000000000000000000000000000000000000000000' in /in/Oo2JU:17 Stack trace: #0 /in/Oo2JU(22): test(Resource id #5) #1 {main} thrown in /in/Oo2JU on line 17
Process exited with code 255.
Output for 5.6.19
Warning: gmp_strval(): Unable to convert variable to GMP - string is not an integer in /in/Oo2JU on line 14 Fatal error: Uncaught exception 'Exception' with message 'Not same - base 21 -hkdc8c0jeeb36j57kj5418fakk31 +0000000000000000000000000000' in /in/Oo2JU:17 Stack trace: #0 /in/Oo2JU(22): test(Resource id #5) #1 {main} thrown in /in/Oo2JU on line 17
Process exited with code 255.
Output for 5.6.18
Fatal error: Uncaught exception 'Exception' with message 'Not same - base 9 -42683588035585786513204824852067214641047332636126767243536246601245663688423104682762466223043045 +1876246332470683013433327278342531020283071751080565768432811615703533855751772588387218625378032225537' in /in/Oo2JU:17 Stack trace: #0 /in/Oo2JU(22): test(Resource id #5) #1 {main} thrown in /in/Oo2JU on line 17
Process exited with code 255.
Output for 5.6.17
Warning: gmp_strval(): Unable to convert variable to GMP - string is not an integer in /in/Oo2JU on line 14 Fatal error: Uncaught exception 'Exception' with message 'Not same - base 20 -318e1b00a17abb16hgb0a3iad2fj4i13384eh0b002f8c8f4a1j9d4d8g79bd9iej417ii05i849dicf2he2i +0000000000000000000000000000000000000000000000000000000000000000000000000000000000000' in /in/Oo2JU:17 Stack trace: #0 /in/Oo2JU(22): test(Resource id #5) #1 {main} thrown in /in/Oo2JU on line 17
Process exited with code 255.
Output for 5.6.16
Fatal error: Uncaught exception 'Exception' with message 'Not same - base 5 -2104344434200433032322334232123321413342420402100313420211002043 +2300303432304440411201240023213123333024033433420302442104143202143410214240034043004031133' in /in/Oo2JU:17 Stack trace: #0 /in/Oo2JU(22): test(Resource id #5) #1 {main} thrown in /in/Oo2JU on line 17
Process exited with code 255.
Output for 5.6.15
Warning: gmp_strval(): Unable to convert variable to GMP - string is not an integer in /in/Oo2JU on line 14 Fatal error: Uncaught exception 'Exception' with message 'Not same - base 13 -96a7915383637bc04a758c21436c8831b039746332778500625aa +00000000000000000000000000000000000000000000000000000' in /in/Oo2JU:17 Stack trace: #0 /in/Oo2JU(22): test(Resource id #5) #1 {main} thrown in /in/Oo2JU on line 17
Process exited with code 255.
Output for 5.6.14
Warning: gmp_strval(): Unable to convert variable to GMP - string is not an integer in /in/Oo2JU on line 14 Fatal error: Uncaught exception 'Exception' with message 'Not same - base 23 -e5h82f79e7calek5gm3ge5kfi9g9l23h028069ab7lle4c76fm2f9fm562ka2cb85dbl5gbjdl4e70 +000000000000000000000000000000000000000000000000000000000000000000000000000000' in /in/Oo2JU:17 Stack trace: #0 /in/Oo2JU(22): test(Resource id #5) #1 {main} thrown in /in/Oo2JU on line 17
Process exited with code 255.
Output for 5.6.13
Warning: gmp_strval(): Unable to convert variable to GMP - string is not an integer in /in/Oo2JU on line 14 Fatal error: Uncaught exception 'Exception' with message 'Not same - base 21 -hb8d7jif879aa9jk3e47786id35gek7149cgghha7k91934ad74i86eg119274dddba8ff88eh42e1a0543i3gba48 +000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000' in /in/Oo2JU:17 Stack trace: #0 /in/Oo2JU(22): test(Resource id #5) #1 {main} thrown in /in/Oo2JU on line 17
Process exited with code 255.
Output for 5.6.12
Warning: gmp_strval(): Unable to convert variable to GMP - string is not an integer in /in/Oo2JU on line 14 Fatal error: Uncaught exception 'Exception' with message 'Not same - base 17 -65b6c05e1c90332ee1c9e6faa8be23 +000000000000000000000000000000' in /in/Oo2JU:17 Stack trace: #0 /in/Oo2JU(22): test(Resource id #5) #1 {main} thrown in /in/Oo2JU on line 17
Process exited with code 255.
Output for 5.6.11
Warning: gmp_strval(): Unable to convert variable to GMP - string is not an integer in /in/Oo2JU on line 14 Fatal error: Uncaught exception 'Exception' with message 'Not same - base 27 -2phm71fkdq39g4i90c4mohjqo51ebpdplam2mpi8q3n3i7b9ng1gh6ino4718hdjpd8i1q62noe95g7co0ni8b3apckmopm8nj9 +000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000' in /in/Oo2JU:17 Stack trace: #0 /in/Oo2JU(22): test(Resource id #5) #1 {main} thrown in /in/Oo2JU on line 17
Process exited with code 255.
Output for 5.6.10
Warning: gmp_strval(): Unable to convert variable to GMP - string is not an integer in /in/Oo2JU on line 14 Fatal error: Uncaught exception 'Exception' with message 'Not same - base 16 -ec7eed3e3460011c +0000000000000000' in /in/Oo2JU:17 Stack trace: #0 /in/Oo2JU(22): test(Resource id #5) #1 {main} thrown in /in/Oo2JU on line 17
Process exited with code 255.
Output for 5.6.9
Warning: gmp_strval(): Unable to convert variable to GMP - string is not an integer in /in/Oo2JU on line 14 Fatal error: Uncaught exception 'Exception' with message 'Not same - base 28 -idca5ob4ek0i7hfi8m601lllmpmhcqr2j3h04mj8pld5l68gpp3aamegd +000000000000000000000000000000000000000000000000000000000' in /in/Oo2JU:17 Stack trace: #0 /in/Oo2JU(22): test(Resource id #5) #1 {main} thrown in /in/Oo2JU on line 17
Process exited with code 255.
Output for 5.6.8
Warning: gmp_strval(): Unable to convert variable to GMP - string is not an integer in /in/Oo2JU on line 14 Fatal error: Uncaught exception 'Exception' with message 'Not same - base 29 -qhaef40abanhorp53msnld0edm8a598nlq6ih4a73i1mb8 +0000000000000000000000000000000000000000000000' in /in/Oo2JU:17 Stack trace: #0 /in/Oo2JU(22): test(Resource id #5) #1 {main} thrown in /in/Oo2JU on line 17
Process exited with code 255.
Output for 5.5.34
Fatal error: Uncaught exception 'Exception' with message 'Not same - base 33 -o70965r7pkd01n6e6lu9m7otfc4sj6q1vj68l1r6q6g3lg77gd606pgjln0e +000000000000000000000000000000000000000000000000000000000000' in /in/Oo2JU:17 Stack trace: #0 /in/Oo2JU(22): test(Resource id #5) #1 {main} thrown in /in/Oo2JU on line 17
Process exited with code 255.
Output for 5.5.33
Fatal error: Uncaught exception 'Exception' with message 'Not same - base 36 -cnsvweo1ck1a75zabu65jqrhlj5w667xbv2ooqdb0gargsxo9yu6kr61va0r7w1age8mdsr +00000000000000000000000000000000000000000000000000000000000000000000000' in /in/Oo2JU:17 Stack trace: #0 /in/Oo2JU(22): test(Resource id #5) #1 {main} thrown in /in/Oo2JU on line 17
Process exited with code 255.
Output for 5.5.32
Fatal error: Uncaught exception 'Exception' with message 'Not same - base 28 -jd6d4idr62h30kak73l8oiromlgnq +00000000000000000000000000000' in /in/Oo2JU:17 Stack trace: #0 /in/Oo2JU(22): test(Resource id #5) #1 {main} thrown in /in/Oo2JU on line 17
Process exited with code 255.
Output for 5.5.31
Fatal error: Uncaught exception 'Exception' with message 'Not same - base 22 -8ac0ha7hdcg0ek5135fk508a620h38ae6cllh4eiccjb768al0460849add13989e23b409k680a6jad36h4 +000000000000000000000000000000000000000000000000000000000000000000000000000000000000' in /in/Oo2JU:17 Stack trace: #0 /in/Oo2JU(22): test(Resource id #5) #1 {main} thrown in /in/Oo2JU on line 17
Process exited with code 255.
Output for 5.5.30
Fatal error: Uncaught exception 'Exception' with message 'Not same - base 8 -34460752042202207444214762463375235415717074445106001607136750 +125617241732550534040226115746363734507111705511222544072317116012756' in /in/Oo2JU:17 Stack trace: #0 /in/Oo2JU(22): test(Resource id #5) #1 {main} thrown in /in/Oo2JU on line 17
Process exited with code 255.
Output for 5.5.29
Fatal error: Uncaught exception 'Exception' with message 'Not same - base 27 -4qof4hk12lde3jgi8e5j54gcda63lbc607lf7gfii0hg2ml8chb864angn8j9gqg4520bhij87n6921iphjb24bo47padacbmoqf +0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000' in /in/Oo2JU:17 Stack trace: #0 /in/Oo2JU(22): test(Resource id #5) #1 {main} thrown in /in/Oo2JU on line 17
Process exited with code 255.
Output for 5.5.28
Fatal error: Uncaught exception 'Exception' with message 'Not same - base 11 -32421827a759736a35930506919a3770845a92aa2aa6849022611385030391619445 +00000000000000000000000000000000000000000000000000000000000000000000' in /in/Oo2JU:17 Stack trace: #0 /in/Oo2JU(22): test(Resource id #5) #1 {main} thrown in /in/Oo2JU on line 17
Process exited with code 255.
Output for 5.5.27
Fatal error: Uncaught exception 'Exception' with message 'Not same - base 8 -1476765161307 +25372604013533' in /in/Oo2JU:17 Stack trace: #0 /in/Oo2JU(22): test(Resource id #5) #1 {main} thrown in /in/Oo2JU on line 17
Process exited with code 255.
Output for 5.5.26
Fatal error: Uncaught exception 'Exception' with message 'Not same - base 6 -1433123440015433340051041450420513 +2551131340130104121022355555013513115554545' in /in/Oo2JU:17 Stack trace: #0 /in/Oo2JU(22): test(Resource id #5) #1 {main} thrown in /in/Oo2JU on line 17
Process exited with code 255.
Output for 5.5.25
Fatal error: Uncaught exception 'Exception' with message 'Not same - base 31 -honc9ggj001om7l9471ekd2l3j6i662t31ni5tcujhdhhu +0000000000000000000000000000000000000000000000' in /in/Oo2JU:17 Stack trace: #0 /in/Oo2JU(22): test(Resource id #5) #1 {main} thrown in /in/Oo2JU on line 17
Process exited with code 255.
Output for 5.5.24
Fatal error: Uncaught exception 'Exception' with message 'Not same - base 25 -8ddidfb1adj8i6o72kio0ahjb29nmg3490hn433nf9l2mf3fd +0000000000000000000000000000000000000000000000000' in /in/Oo2JU:17 Stack trace: #0 /in/Oo2JU(22): test(Resource id #5) #1 {main} thrown in /in/Oo2JU on line 17
Process exited with code 255.
Output for 5.4.45
Fatal error: Uncaught exception 'Exception' with message 'Not same - base 31 -u75kef8cob6f6sapom9gs4kk88dr1mun0igtr91krp32p7k +00000000000000000000000000000000000000000000000' in /in/Oo2JU:17 Stack trace: #0 /in/Oo2JU(22): test(Resource id #5) #1 {main} thrown in /in/Oo2JU on line 17
Process exited with code 255.
Output for 5.4.44
Fatal error: Uncaught exception 'Exception' with message 'Not same - base 10 -0334524954052638610162323541065530 +0000000000000000000000000000000000' in /in/Oo2JU:17 Stack trace: #0 /in/Oo2JU(22): test(Resource id #5) #1 {main} thrown in /in/Oo2JU on line 17
Process exited with code 255.
Output for 5.4.43
Fatal error: Uncaught exception 'Exception' with message 'Not same - base 14 -d96c26ca5333c2c913b78b +0000000000000000000000' in /in/Oo2JU:17 Stack trace: #0 /in/Oo2JU(22): test(Resource id #5) #1 {main} thrown in /in/Oo2JU on line 17
Process exited with code 255.
Output for 5.4.42
Fatal error: Uncaught exception 'Exception' with message 'Not same - base 11 -99247702306a837650418a600a02081 +0000000000000000000000000000000' in /in/Oo2JU:17 Stack trace: #0 /in/Oo2JU(22): test(Resource id #5) #1 {main} thrown in /in/Oo2JU on line 17
Process exited with code 255.
Output for 5.4.41
Fatal error: Uncaught exception 'Exception' with message 'Not same - base 19 -145a93he5cf195313383ibib1e3h8280a72 +00000000000000000000000000000000000' in /in/Oo2JU:17 Stack trace: #0 /in/Oo2JU(22): test(Resource id #5) #1 {main} thrown in /in/Oo2JU on line 17
Process exited with code 255.
Output for 5.4.40
Fatal error: Uncaught exception 'Exception' with message 'Not same - base 35 -43kc9ajw5ha546ant422efixhcwgs6ejoe6bgp +00000000000000000000000000000000000000' in /in/Oo2JU:17 Stack trace: #0 /in/Oo2JU(22): test(Resource id #5) #1 {main} thrown in /in/Oo2JU on line 17
Process exited with code 255.
Output for 5.4.39
Fatal error: Uncaught exception 'Exception' with message 'Not same - base 27 -jiko3f8qj51hdmhce1qn2ihg1hmeaco7h8bg73m4h8b9a86347mce0lon5bj3c9oo6oeec9kl44i22onq6k6big9pqcc35b15 +0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000' in /in/Oo2JU:17 Stack trace: #0 /in/Oo2JU(22): test(Resource id #5) #1 {main} thrown in /in/Oo2JU on line 17
Process exited with code 255.
Output for 5.4.38
Fatal error: Uncaught exception 'Exception' with message 'Not same - base 31 -jnqsgjiedh1tsi7md7mmqj723bs98n5sbcnpidlr3c55mft1ds9s518k55ocps87d6oo6fb9bkb4obk5dp8lngfi6dif75n4k6ri +0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000' in /in/Oo2JU:17 Stack trace: #0 /in/Oo2JU(22): test(Resource id #5) #1 {main} thrown in /in/Oo2JU on line 17
Process exited with code 255.
Output for 5.4.37
Fatal error: Uncaught exception 'Exception' with message 'Not same - base 28 -ei3567lc7jebfdcf8bh2apofigii5h02on7c +000000000000000000000000000000000000' in /in/Oo2JU:17 Stack trace: #0 /in/Oo2JU(22): test(Resource id #5) #1 {main} thrown in /in/Oo2JU on line 17
Process exited with code 255.
Output for 5.4.36
Fatal error: Uncaught exception 'Exception' with message 'Not same - base 30 -ql33nmjlokom7lbcnipibk8kq4nci2g4ckjf89k70odpa3aip7s5r9l7j8qe3 +0000000000000000000000000000000000000000000000000000000000000' in /in/Oo2JU:17 Stack trace: #0 /in/Oo2JU(22): test(Resource id #5) #1 {main} thrown in /in/Oo2JU on line 17
Process exited with code 255.
Output for 5.4.35
Fatal error: Uncaught exception 'Exception' with message 'Not same - base 16 -c75ee60cda52616a693e20e68341d7 +000000000000000000000000000000' in /in/Oo2JU:17 Stack trace: #0 /in/Oo2JU(22): test(Resource id #5) #1 {main} thrown in /in/Oo2JU on line 17
Process exited with code 255.
Output for 5.4.34
Fatal error: Uncaught exception 'Exception' with message 'Not same - base 4 -0030000333210330221133112203103202320320112212323212010201213 +3000000123122020123002101023121022100121003100103100122001022101103103101100020100022023' in /in/Oo2JU:17 Stack trace: #0 /in/Oo2JU(22): test(Resource id #5) #1 {main} thrown in /in/Oo2JU on line 17
Process exited with code 255.
Output for 4.4.2 - 4.4.9
Parse error: syntax error, unexpected T_NEW in /in/Oo2JU on line 17
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_NEW in /in/Oo2JU on line 17
Process exited with code 255.
Output for 4.3.2 - 4.3.4
Parse error: parse error in /in/Oo2JU on line 17
Process exited with code 255.