3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $jsonReplaces = array(array("\\", "/", "\n", "\t", "\r", "\b", "\f", '"'), array('\\\\', '\\/', '\\n', '\\t', '\\r', '\\b', '\\f', '\"')); var_dump($jsonReplaces);
based on j01Mc
Output for 5.2.5 - 5.6.28, hhvm-3.10.0 - 3.12.0, 7.0.0 - 7.1.0
array(2) { [0]=> array(8) { [0]=> string(1) "\" [1]=> string(1) "/" [2]=> string(1) " " [3]=> string(1) " " [4]=> string(1) " " [5]=> string(2) "\b" [6]=> string(1) " " [7]=> string(1) """ } [1]=> array(8) { [0]=> string(2) "\\" [1]=> string(2) "\/" [2]=> string(2) "\n" [3]=> string(2) "\t" [4]=> string(2) "\r" [5]=> string(2) "\b" [6]=> string(2) "\f" [7]=> string(2) "\"" } }
Output for 4.3.0 - 5.2.4
array(2) { [0]=> array(8) { [0]=> string(1) "\" [1]=> string(1) "/" [2]=> string(1) " " [3]=> string(1) " " [4]=> string(1) " " [5]=> string(2) "\b" [6]=> string(2) "\f" [7]=> string(1) """ } [1]=> array(8) { [0]=> string(2) "\\" [1]=> string(2) "\/" [2]=> string(2) "\n" [3]=> string(2) "\t" [4]=> string(2) "\r" [5]=> string(2) "\b" [6]=> string(2) "\f" [7]=> string(2) "\"" } }