3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php function Lottery($param, $double=1000){ if(empty($param)) return 0; $data = array(); foreach ($param as $k => $v) { $temp = array_fill(0,$v[0]*$double, $v[1]); $data = array_merge($data, $temp); unset($temp); } $num = mt_rand(0,99*1000); return $data[$num]; } $param = array( 0=>array(0=>50, 1=>2), 1=>array(0=>30, 1=>3), 2=>array(0=>19.988, 1=>10), 3=>array(0=>0.002, 1=>20), 4=>array(0=>0.01, 1=>50), ); echo Lottery($param);
based on CJCu2
Output for 5.1.3 - 5.1.4, 5.2.8, 5.2.11, 5.2.14, 5.3.12, 5.3.20, 5.3.27, 5.4.1, 5.4.9, 5.4.12, 5.4.18 - 5.4.20, 5.4.22, 5.4.25, 5.4.27 - 5.4.28, 5.4.31, 5.4.34, 5.4.45 - 5.5.24, 5.5.31 - 5.5.32, 5.6.12, 5.6.18 - 5.6.20, 7.0.0, 7.0.2, 7.1.0
10
Output for 5.0.0 - 5.0.1, 5.0.5, 5.1.5 - 5.1.6, 5.2.1 - 5.2.2, 5.2.4 - 5.2.7, 5.2.9, 5.2.12 - 5.2.13, 5.2.15, 5.2.17, 5.3.2 - 5.3.5, 5.3.7, 5.3.10 - 5.3.11, 5.3.13, 5.3.15 - 5.3.16, 5.3.18, 5.3.21, 5.3.23, 5.3.25, 5.3.28, 5.4.0, 5.4.2, 5.4.5 - 5.4.7, 5.4.11, 5.4.13 - 5.4.15, 5.4.21, 5.4.23 - 5.4.24, 5.4.26, 5.4.30, 5.4.35 - 5.4.36, 5.4.39 - 5.4.44, 5.5.26 - 5.5.28, 5.5.35 - 5.6.9, 5.6.11, 5.6.13 - 5.6.16, 5.6.21, hhvm-3.12.0, 7.0.1, 7.0.5, 7.0.14
2
Output for 5.0.2 - 5.0.4, 5.1.0 - 5.1.2, 5.2.0, 5.2.3, 5.2.10, 5.2.16, 5.3.0 - 5.3.1, 5.3.6, 5.3.8 - 5.3.9, 5.3.14, 5.3.17, 5.3.19, 5.3.22, 5.3.24, 5.3.26, 5.3.29, 5.4.3 - 5.4.4, 5.4.8, 5.4.10, 5.4.16 - 5.4.17, 5.4.29, 5.4.32, 5.4.37 - 5.4.38, 5.5.25, 5.5.29 - 5.5.30, 5.5.33 - 5.5.34, 5.6.10, 5.6.17, 5.6.28, 7.0.3 - 7.0.4, 7.0.6
3
Output for hhvm-3.10.0

Process exited with code 153.
Output for 4.4.9
*** Error in `/bin/php-4.4.9': free(): invalid next size (fast): 0x0000000002838040 ***
Process exited with code 139.
Output for 4.4.8
*** Error in `/bin/php-4.4.8': free(): invalid next size (fast): 0x000000000319f040 ***
Process exited with code 139.
Output for 4.4.7
*** Error in `/bin/php-4.4.7': free(): invalid next size (fast): 0x00000000025aff60 ***
Process exited with code 139.
Output for 4.4.6
*** Error in `/bin/php-4.4.6': free(): invalid next size (fast): 0x00000000029aaf60 ***
Process exited with code 139.
Output for 4.4.5
*** Error in `/bin/php-4.4.5': free(): invalid next size (fast): 0x0000000002e23f60 ***
Process exited with code 139.
Output for 4.4.4
*** Error in `/bin/php-4.4.4': free(): invalid next size (fast): 0x0000000002ec8f60 ***
Process exited with code 139.
Output for 4.4.3
*** Error in `/bin/php-4.4.3': free(): invalid next size (fast): 0x0000000003c55f60 ***
Process exited with code 139.
Output for 4.4.2
*** Error in `/bin/php-4.4.2': corrupted double-linked list: 0x0000000000b55c70 ***
Process exited with code 137.
Output for 4.4.1
*** Error in `/bin/php-4.4.1': double free or corruption (!prev): 0x0000000000a93c80 ***
Process exited with code 139.
Output for 4.4.0
*** Error in `/bin/php-4.4.0': free(): invalid next size (fast): 0x000000000351ed90 ***
Process exited with code 139.
Output for 4.3.11
*** Error in `/bin/php-4.3.11': free(): invalid next size (fast): 0x0000000002ffa8a0 ***
Process exited with code 139.
Output for 4.3.10
*** Error in `/bin/php-4.3.10': free(): invalid next size (fast): 0x00000000028df7a0 ***
Process exited with code 139.
Output for 4.3.9
*** Error in `/bin/php-4.3.9': free(): invalid next size (fast): 0x0000000002285630 ***
Process exited with code 139.
Output for 4.3.8
*** Error in `/bin/php-4.3.8': free(): invalid next size (fast): 0x00000000036bf0a0 ***
Process exited with code 139.
Output for 4.3.7
*** Error in `/bin/php-4.3.7': free(): invalid next size (fast): 0x00000000031c4680 ***
Process exited with code 139.
Output for 4.3.6
*** Error in `/bin/php-4.3.6': free(): invalid next size (fast): 0x00000000033eb6a0 ***
Process exited with code 139.
Output for 4.3.5
*** Error in `/bin/php-4.3.5': free(): invalid next size (fast): 0x00000000025d8520 ***
Process exited with code 139.
Output for 4.3.4
*** Error in `/bin/php-4.3.4': free(): invalid next size (fast): 0x0000000003343c70 ***
Process exited with code 139.
Output for 4.3.3
*** Error in `/bin/php-4.3.3': free(): invalid next size (fast): 0x0000000003546e50 ***
Process exited with code 139.
Output for 4.3.2
*** Error in `/bin/php-4.3.2': free(): invalid next size (fast): 0x00000000036c8eb0 ***
Process exited with code 139.
Output for 4.3.1
*** Error in `/bin/php-4.3.1': free(): invalid next size (fast): 0x0000000002271760 ***
Process exited with code 139.
Output for 4.3.0
*** Error in `/bin/php-4.3.0': free(): invalid next size (fast): 0x00000000031724e0 *** ======= Backtrace: ========= /usr/lib/libc.so.6(+0x72055)[0x7f46a8860055] /usr/lib/libc.so.6(+0x779a6)[0x7f46a88659a6] /usr/lib/libc.so.6(+0x7818e)[0x7f46a886618e] /bin/php-4.3.0(_efree+0x71)[0x50a711] /bin/php-4.3.0(zend_hash_destroy+0x4d)[0x51eadd] /bin/php-4.3.0(_zval_dtor+0x76)[0x518e86] /bin/php-4.3.0(_zval_ptr_dtor+0x35)[0x510ac5] /bin/php-4.3.0(zend_hash_del_key_or_index+0x197)[0x51e967] /bin/php-4.3.0(execute+0x16a4)[0x529bc4] /bin/php-4.3.0(execute+0x425)[0x528945] /bin/php-4.3.0(zend_execute_scripts+0x119)[0x51a3b9] /bin/php-4.3.0(php_execute_script+0x268)[0x4f18d8] /bin/php-4.3.0(main+0xb20)[0x425500] /usr/lib/libc.so.6(__libc_start_main+0xf0)[0x7f46a880e610] /bin/php-4.3.0[0x4258dd] ======= Memory map: ======== 00400000-005c7000 r-xp 00000000 00:00 0 005c7000-007c6000 ---p 00000000 00:00 0 007c6000-007e6000 rwxp 00000000 00:00 0 00800000-00801000 rwxp 00000000 00:00 0 01c80000-03e89000 rwxp 00000000 00:00 0 [heap] 7f46a4000000-7f46a4021000 rwxp 00000000 00:00 0 7f46a4021000-7f46a8000000 ---p 00000000 00:00 0 7f46a81c1000-7f46a81d7000 r-xp 00000000 00:12 45938 /usr/lib/libgcc_s.so.1 7f46a81d7000-7f46a83d6000 ---p 00016000 00:12 45938 /usr/lib/libgcc_s.so.1 7f46a83d6000-7f46a83d7000 rwxp 00015000 00:12 45938 /usr/lib/libgcc_s.so.1 7f46a83d7000-7f46a84d8000 rwxp 00000000 00:00 0 7f46a85d9000-7f46a85e4000 r-xp 00000000 00:12 45210 /usr/lib/libnss_files-2.22.so 7f46a85e4000-7f46a87e3000 ---p 0000b000 00:12 45210 /usr/lib/libnss_files-2.22.so 7f46a87e3000-7f46a87e4000 r-xp 0000a000 00:12 45210 /usr/lib/libnss_files-2.22.so 7f46a87e4000-7f46a87e5000 rwxp 0000b000 00:12 45210 /usr/lib/libnss_files-2.22.so 7f46a87e5000-7f46a87ee000 rwxp 00000000 00:00 0 7f46a87ee000-7f46a8989000 r-xp 00000000 00:12 45203 /usr/lib/libc-2.22.so 7f46a8989000-7f46a8b88000 ---p 0019b000 00:12 45203 /usr/lib/libc-2.22.so 7f46a8b88000-7f46a8b8c000 r-xp 0019a000 00:12 45203 /usr/lib/libc-2.22.so 7f46a8b8c000-7f46a8b8e000 rwxp 0019e000 00:12 45203 /usr/lib/libc-2.22.so 7f46a8b8e000-7f46a8b93000 rwxp 00000000 00:00 0 7f46a8b93000-7f46a8ba8000 r-xp 00000000 00:12 45186 /usr/lib/libnsl-2.22.so 7f46a8ba8000-7f46a8da7000 ---p 00015000 00:12 45186 /usr/lib/libnsl-2.22.so 7f46a8da7000-7f46a8da8000 r-xp 00014000 00:12 45186 /usr/lib/libnsl-2.22.so 7f46a8da8000-7f46a8da9000 rwxp 00015000 00:12 45186 /usr/lib/libnsl-2.22.so 7f46a8da9000-7f46a8dab000 rwxp 00000000 00:00 0 7f46a8dab000-7f46a8dae000 r-xp 00000000 00:12 45173 /usr/lib/libdl-2.22.so 7f46a8dae000-7f46a8fad000 ---p 00003000 00:12 45173 /usr/lib/libdl-2.22.so 7f46a8fad000-7f46a8fae000 r-xp 00002000 00:12 45173 /usr/lib/libdl-2.22.so 7f46a8fae000-7f46a8faf000 rwxp 00003000 00:12 45173 /usr/lib/libdl-2.22.so 7f46a8faf000-7f46a90ac000 r-xp 00000000 00:12 45196 /usr/lib/libm-2.22.so 7f46a90ac000-7f46a92ab000 ---p 000fd000 00:12 45196 /usr/lib/libm-2.22.so 7f46a92ab000-7f46a92ac000 r-xp 000fc000 00:12 45196 /usr/lib/libm-2.22.so 7f46a92ac000-7f46a92ad000 rwxp 000fd000 00:12 45196 /usr/lib/libm-2.22.so 7f46a92ad000-7f46a92ae000 rwxp 00000000 00:00 0 7f46a92ae000-7f46a92c2000 r-xp 00000000 00:12 45194 /usr/lib/libresolv-2.22.so 7f46a92c2000-7f46a94c1000 ---p 00014000 00:12 45194 /usr/lib/libresolv-2.22.so 7f46a94c1000-7f46a94c2000 r-xp 00013000 00:12 45194 /usr/lib/libresolv-2.22.so 7f46a94c2000-7f46a94c3000 rwxp 00014000 00:12 45194 /usr/lib/libresolv-2.22.so 7f46a94c3000-7f46a94c5000 rwxp 00000000 00:00 0 7f46a94c5000-7f46a94cd000 r-xp 00000000 00:12 45185 /usr/lib/libcrypt-2.22.so 7f46a94cd000-7f46a96cd000 ---p 00008000 00:12 45185 /usr/lib/libcrypt-2.22.so 7f46a96cd000-7f46a96ce000 r-xp 00008000 00:12 45185 /usr/lib/libcrypt-2.22.so 7f46a96ce000-7f46a96cf000 rwxp 00009000 00:12 45185 /usr/lib/libcrypt-2.22.so 7f46a96cf000-7f46a96fd000 rwxp 00000000 00:00 0 7f46a96fd000-7f46a9712000 r-xp 00000000 00:12 25251 /usr/lib/libz.so.1.2.8 7f46a9712000-7f46a9911000 ---p 00015000 00:12 25251 /usr/lib/libz.so.1.2.8 7f46a9911000-7f46a9912000 r-xp 00014000 00:12 25251 /usr/lib/libz.so.1.2.8 7f46a9912000-7f46a9913000 rwxp 00015000 00:12 25251 /usr/lib/libz.so.1.2.8 7f46a9913000-7f46a9914000 rwxp 00000000 00:00 0 7f46a991e000-7f46a991f000 rwxp 00000000 00:00 0 7f46a991f000-7f46a9941000 r-xp 00000000 00:12 45170 /usr/lib/ld-2.22.so 7f46a9941000-7f46a9b40000 ---p 00000000 00:00 0 7f46a9b40000-7f46a9b41000 r-xp 00021000 00:12 45170 /usr/lib/ld-2.22.so 7f46a9b41000-7f46a9b42000 rwxp 00022000 00:12 45170 /usr/lib/ld-2.22.so 7f46a9b42000-7f46a9b43000 rwxp 00000000 00:00 0 7ffc03f1b000-7ffc03f3c000 rwxp 00000000 00:00 0 [stack] 7ffc03f61000-7ffc03f63000 r--p 00000000 00:00 0 [vvar] 7ffc03f63000-7ffc03f65000 r-xp 00000000 00:00 0 [vdso] ffffffffff600000-ffffffffff601000 r-xp 00000000 00:00 0 [vsyscall]
Process exited with code 134.