3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php function getTopNews($number = 5,$reset =false) { static $cache = false; //cache reset if ($reset) $cache = false; //cache get if ($cache){ echo 'cache '; return $cache; } else { echo 'query '; /*$res = db_query("SELECT id,header,content FROM `news` ORDER BY id DESC LIMIT %d",(int)$number); while($row = db_fetch_array($res)){ $out[] = $row; } */ $out ='db'+rand(1,111); //cache set $cache = $out; } return $out; } echo getTopNews(); echo '<br />'; echo getTopNews();
Output for 7.1.0
query Warning: A non-numeric value encountered in /in/G88GV on line 24 35<br />cache 35
Output for 4.3.3, 4.3.10, 5.4.39, 7.0.14
query 1<br />cache 1
Output for 7.0.6
query 65<br />cache 65
Output for 7.0.5
query 22<br />cache 22
Output for 7.0.4
query 10<br />cache 10
Output for 5.2.0, 5.5.28, 7.0.3
query 74<br />cache 74
Output for 4.4.2, 5.2.17, 7.0.2
query 102<br />cache 102
Output for 5.4.36, 7.0.1
query 33<br />cache 33
Output for 5.3.25, hhvm-3.12.0, 7.0.0
query 59<br />cache 59
Output for hhvm-3.10.0
query 53<br />cache 53
Output for 5.2.4, 5.3.17, 5.4.15, 5.4.29, 5.6.1, 5.6.28
query 108<br />cache 108
Output for 5.5.22, 5.6.21
query 106<br />cache 106
Output for 5.2.8, 5.4.30, 5.6.20
query 52<br />cache 52
Output for 5.0.4, 5.3.26, 5.6.19
query 12<br />cache 12
Output for 5.3.7, 5.4.21, 5.6.18
query 71<br />cache 71
Output for 5.0.2, 5.4.5, 5.6.17
query 49<br />cache 49
Output for 4.4.0, 5.4.7, 5.4.16, 5.5.21, 5.6.13, 5.6.16
query 80<br />cache 80
Output for 5.4.31, 5.6.15
query 57<br />cache 57
Output for 5.4.38, 5.5.19, 5.6.14
query 97<br />cache 97
Output for 5.6.12
query 104<br />cache 104
Output for 5.2.3, 5.3.5, 5.6.8, 5.6.11
query 68<br />cache 68
Output for 5.1.4, 5.2.10, 5.5.35, 5.6.10
query 55<br />cache 55
Output for 5.4.23, 5.5.4, 5.5.34, 5.6.9
query 60<br />cache 60
Output for 5.5.24, 5.6.7
query 51<br />cache 51
Output for 5.3.23, 5.4.9, 5.6.0, 5.6.6
query 30<br />cache 30
Output for 5.4.20, 5.5.26, 5.6.5
query 16<br />cache 16
Output for 5.3.9, 5.3.13, 5.4.2, 5.6.4
query 111<br />cache 111
Output for 4.4.1, 5.2.7, 5.6.3
query 35<br />cache 35
Output for 5.1.6, 5.6.2
query 7<br />cache 7
Output for 5.2.15, 5.5.33
query 96<br />cache 96
Output for 5.2.5, 5.3.20, 5.5.32
query 63<br />cache 63
Output for 4.3.5, 5.5.31
query 75<br />cache 75
Output for 5.1.1, 5.3.12, 5.3.15, 5.4.44, 5.5.30
query 103<br />cache 103
Output for 5.3.1, 5.3.6, 5.4.32, 5.5.29
query 77<br />cache 77
Output for 5.1.0, 5.3.16, 5.4.12, 5.5.6, 5.5.27
query 31<br />cache 31
Output for 5.5.25
query 93<br />cache 93
Output for 5.3.22, 5.5.23
query 76<br />cache 76
Output for 5.5.20
query 26<br />cache 26
Output for 4.3.8, 5.5.18
query 58<br />cache 58
Output for 4.4.7, 5.5.16
query 23<br />cache 23
Output for 5.0.5, 5.5.15
query 92<br />cache 92
Output for 4.3.9, 5.5.14
query 40<br />cache 40
Output for 5.5.13
query 5<br />cache 5
Output for 5.0.0, 5.4.41, 5.5.12
query 81<br />cache 81
Output for 5.3.14, 5.4.17, 5.5.11
query 73<br />cache 73
Output for 4.3.4, 5.5.10
query 29<br />cache 29
Output for 5.3.19, 5.5.9
query 36<br />cache 36
Output for 5.5.8
query 83<br />cache 83
Output for 5.3.28, 5.4.18, 5.5.7
query 34<br />cache 34
Output for 5.5.0, 5.5.5
query 38<br />cache 38
Output for 5.5.3
query 110<br />cache 110
Output for 5.2.1, 5.5.2
query 6<br />cache 6
Output for 5.5.1
query 15<br />cache 15
Output for 5.4.45
query 101<br />cache 101
Output for 5.4.43
query 42<br />cache 42
Output for 4.4.3, 5.4.14, 5.4.42
query 84<br />cache 84
Output for 4.3.7, 5.0.3, 5.1.2, 5.3.11, 5.4.40
query 89<br />cache 89
Output for 5.4.37
query 94<br />cache 94
Output for 4.3.0, 5.4.35
query 24<br />cache 24
Output for 5.3.0, 5.4.34
query 82<br />cache 82
Output for 5.4.28
query 78<br />cache 78
Output for 5.4.27
query 95<br />cache 95
Output for 5.3.4, 5.4.26
query 67<br />cache 67
Output for 5.4.25
query 69<br />cache 69
Output for 5.2.16, 5.4.24
query 25<br />cache 25
Output for 5.4.4, 5.4.22
query 27<br />cache 27
Output for 5.4.19
query 47<br />cache 47
Output for 4.4.8, 5.4.8, 5.4.13
query 98<br />cache 98
Output for 5.4.11
query 90<br />cache 90
Output for 5.4.10
query 64<br />cache 64
Output for 5.4.6
query 86<br />cache 86
Output for 5.3.8, 5.4.3
query 28<br />cache 28
Output for 5.2.12, 5.3.27, 5.4.1
query 8<br />cache 8
Output for 5.2.6, 5.4.0
query 17<br />cache 17
Output for 4.3.1, 5.3.29
query 99<br />cache 99
Output for 5.3.24
query 72<br />cache 72
Output for 5.3.21
query 62<br />cache 62
Output for 5.3.18
query 66<br />cache 66
Output for 5.3.10
query 11<br />cache 11
Output for 4.3.6, 5.3.3
query 32<br />cache 32
Output for 5.3.2
query 19<br />cache 19
Output for 5.2.14
query 37<br />cache 37
Output for 5.2.13
query 79<br />cache 79
Output for 5.2.11
query 61<br />cache 61
Output for 5.2.9
query 91<br />cache 91
Output for 5.2.2
query 56<br />cache 56
Output for 4.4.9, 5.1.5
query 14<br />cache 14
Output for 5.1.3
query 39<br />cache 39
Output for 5.0.1
query 100<br />cache 100
Output for 4.4.6
query 2<br />cache 2
Output for 4.4.5
query 87<br />cache 87
Output for 4.4.4
query 48<br />cache 48
Output for 4.3.11
query 9<br />cache 9
Output for 4.3.2
query 88<br />cache 88