3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php function getBitStream($string) { $stream = []; foreach (str_split($string) as $byte) { $bits = str_split(sprintf('%08d', decbin(ord($byte)))); $stream = array_merge($stream, $bits); } return $stream; } var_dump(getBitStream('hello world!'));
Output for 5.4.0 - 5.6.28, hhvm-3.12.0, 7.0.0 - 7.1.0
array(96) { [0]=> string(1) "0" [1]=> string(1) "1" [2]=> string(1) "1" [3]=> string(1) "0" [4]=> string(1) "1" [5]=> string(1) "0" [6]=> string(1) "0" [7]=> string(1) "0" [8]=> string(1) "0" [9]=> string(1) "1" [10]=> string(1) "1" [11]=> string(1) "0" [12]=> string(1) "0" [13]=> string(1) "1" [14]=> string(1) "0" [15]=> string(1) "1" [16]=> string(1) "0" [17]=> string(1) "1" [18]=> string(1) "1" [19]=> string(1) "0" [20]=> string(1) "1" [21]=> string(1) "1" [22]=> string(1) "0" [23]=> string(1) "0" [24]=> string(1) "0" [25]=> string(1) "1" [26]=> string(1) "1" [27]=> string(1) "0" [28]=> string(1) "1" [29]=> string(1) "1" [30]=> string(1) "0" [31]=> string(1) "0" [32]=> string(1) "0" [33]=> string(1) "1" [34]=> string(1) "1" [35]=> string(1) "0" [36]=> string(1) "1" [37]=> string(1) "1" [38]=> string(1) "1" [39]=> string(1) "1" [40]=> string(1) "0" [41]=> string(1) "0" [42]=> string(1) "1" [43]=> string(1) "0" [44]=> string(1) "0" [45]=> string(1) "0" [46]=> string(1) "0" [47]=> string(1) "0" [48]=> string(1) "0" [49]=> string(1) "1" [50]=> string(1) "1" [51]=> string(1) "1" [52]=> string(1) "0" [53]=> string(1) "1" [54]=> string(1) "1" [55]=> string(1) "1" [56]=> string(1) "0" [57]=> string(1) "1" [58]=> string(1) "1" [59]=> string(1) "0" [60]=> string(1) "1" [61]=> string(1) "1" [62]=> string(1) "1" [63]=> string(1) "1" [64]=> string(1) "0" [65]=> string(1) "1" [66]=> string(1) "1" [67]=> string(1) "1" [68]=> string(1) "0" [69]=> string(1) "0" [70]=> string(1) "1" [71]=> string(1) "0" [72]=> string(1) "0" [73]=> string(1) "1" [74]=> string(1) "1" [75]=> string(1) "0" [76]=> string(1) "1" [77]=> string(1) "1" [78]=> string(1) "0" [79]=> string(1) "0" [80]=> string(1) "0" [81]=> string(1) "1" [82]=> string(1) "1" [83]=> string(1) "0" [84]=> string(1) "0" [85]=> string(1) "1" [86]=> string(1) "0" [87]=> string(1) "0" [88]=> string(1) "0" [89]=> string(1) "0" [90]=> string(1) "1" [91]=> string(1) "0" [92]=> string(1) "0" [93]=> string(1) "0" [94]=> string(1) "0" [95]=> string(1) "1" }
Output for hhvm-3.10.0

Process exited with code 153.
Output for 4.4.2 - 4.4.9, 5.1.0 - 5.3.29
Parse error: syntax error, unexpected '[' in /in/SdrOc on line 5
Process exited with code 255.
Output for 4.3.0 - 4.3.1, 4.3.5 - 4.4.1, 5.0.0 - 5.0.5
Parse error: parse error, unexpected '[' in /in/SdrOc on line 5
Process exited with code 255.
Output for 4.3.2 - 4.3.4
Parse error: parse error in /in/SdrOc on line 5
Process exited with code 255.