3v4l.org

run code in 300+ PHP versions simultaneously
<?php $json_fragment_from_api = '{\"caption\" => \"Genes (Comprehensive set from GENCODE 26)\",\"colour_key\" => \"[biotype]\",\"default\" => {\"MultiBottom\" => \"collapsed_label\",\"MultiTop\" => \"gene_label\",\"alignsliceviewbottom\" => \"as_collapsed_label\",\"contigviewbottom\" => \"transcript_label\",\"contigviewtop\" => \"gene_label\",\"cytoview\" => \"gene_label\"},\"key\" => \"ensembl\",\"label_key\" => \"[biotype]\",\"multi_name\" => \"GENCODE 26 Comprehensive gene set\",\"name\" => \"Comprehensive Gene Annotations from GENCODE 26\"}'; echo $json_frament_from_api; echo "Alex Tartan:\n"; $string = $json_fragment_from_api; $string = str_replace('\"','"', $string); $string = str_replace('=>',':', $string); echo $string; echo "ikegami:\n"; $json_from_api = '{"result":' . $json_fragment_from_api . '}'; $response = json_decode($json_from_api, true); $perl_code = $response["result"]; $desired_json = str_replace(' =>', ':', $perl_code); echo $desired_json; ?>
Output for 8.3.0 - 8.3.4, 8.3.6
Warning: Undefined variable $json_frament_from_api in /in/5XqUX on line 5 Alex Tartan: {"caption" : "Genes (Comprehensive set from GENCODE 26)","colour_key" : "[biotype]","default" : {"MultiBottom" : "collapsed_label","MultiTop" : "gene_label","alignsliceviewbottom" : "as_collapsed_label","contigviewbottom" : "transcript_label","contigviewtop" : "gene_label","cytoview" : "gene_label"},"key" : "ensembl","label_key" : "[biotype]","multi_name" : "GENCODE 26 Comprehensive gene set","name" : "Comprehensive Gene Annotations from GENCODE 26"}ikegami: Warning: Trying to access array offset on null in /in/5XqUX on line 18 Deprecated: str_replace(): Passing null to parameter #3 ($subject) of type array|string is deprecated in /in/5XqUX on line 19
Output for 8.3.5
Warning: PHP Startup: Unable to load dynamic library 'sodium.so' (tried: /usr/lib/php/8.3.5/modules/sodium.so (libsodium.so.23: cannot open shared object file: No such file or directory), /usr/lib/php/8.3.5/modules/sodium.so.so (/usr/lib/php/8.3.5/modules/sodium.so.so: cannot open shared object file: No such file or directory)) in Unknown on line 0 Warning: Undefined variable $json_frament_from_api in /in/5XqUX on line 5 Alex Tartan: {"caption" : "Genes (Comprehensive set from GENCODE 26)","colour_key" : "[biotype]","default" : {"MultiBottom" : "collapsed_label","MultiTop" : "gene_label","alignsliceviewbottom" : "as_collapsed_label","contigviewbottom" : "transcript_label","contigviewtop" : "gene_label","cytoview" : "gene_label"},"key" : "ensembl","label_key" : "[biotype]","multi_name" : "GENCODE 26 Comprehensive gene set","name" : "Comprehensive Gene Annotations from GENCODE 26"}ikegami: Warning: Trying to access array offset on null in /in/5XqUX on line 18 Deprecated: str_replace(): Passing null to parameter #3 ($subject) of type array|string is deprecated in /in/5XqUX on line 19
Output for 8.1.0 - 8.1.28, 8.2.0 - 8.2.18
Warning: Undefined variable $json_frament_from_api in /in/5XqUX on line 5 Alex Tartan: {"caption" : "Genes (Comprehensive set from GENCODE 26)","colour_key" : "[biotype]","default" : {"MultiBottom" : "collapsed_label","MultiTop" : "gene_label","alignsliceviewbottom" : "as_collapsed_label","contigviewbottom" : "transcript_label","contigviewtop" : "gene_label","cytoview" : "gene_label"},"key" : "ensembl","label_key" : "[biotype]","multi_name" : "GENCODE 26 Comprehensive gene set","name" : "Comprehensive Gene Annotations from GENCODE 26"}ikegami: Warning: Trying to access array offset on value of type null in /in/5XqUX on line 18 Deprecated: str_replace(): Passing null to parameter #3 ($subject) of type array|string is deprecated in /in/5XqUX on line 19
Output for 8.0.0 - 8.0.30
Warning: Undefined variable $json_frament_from_api in /in/5XqUX on line 5 Alex Tartan: {"caption" : "Genes (Comprehensive set from GENCODE 26)","colour_key" : "[biotype]","default" : {"MultiBottom" : "collapsed_label","MultiTop" : "gene_label","alignsliceviewbottom" : "as_collapsed_label","contigviewbottom" : "transcript_label","contigviewtop" : "gene_label","cytoview" : "gene_label"},"key" : "ensembl","label_key" : "[biotype]","multi_name" : "GENCODE 26 Comprehensive gene set","name" : "Comprehensive Gene Annotations from GENCODE 26"}ikegami: Warning: Trying to access array offset on value of type null in /in/5XqUX on line 18
Output for 7.4.0 - 7.4.25, 7.4.27 - 7.4.33
Notice: Undefined variable: json_frament_from_api in /in/5XqUX on line 5 Alex Tartan: {"caption" : "Genes (Comprehensive set from GENCODE 26)","colour_key" : "[biotype]","default" : {"MultiBottom" : "collapsed_label","MultiTop" : "gene_label","alignsliceviewbottom" : "as_collapsed_label","contigviewbottom" : "transcript_label","contigviewtop" : "gene_label","cytoview" : "gene_label"},"key" : "ensembl","label_key" : "[biotype]","multi_name" : "GENCODE 26 Comprehensive gene set","name" : "Comprehensive Gene Annotations from GENCODE 26"}ikegami: Notice: Trying to access array offset on value of type null in /in/5XqUX on line 18
Output for 7.3.32 - 7.3.33, 7.4.26
Alex Tartan: {"caption" : "Genes (Comprehensive set from GENCODE 26)","colour_key" : "[biotype]","default" : {"MultiBottom" : "collapsed_label","MultiTop" : "gene_label","alignsliceviewbottom" : "as_collapsed_label","contigviewbottom" : "transcript_label","contigviewtop" : "gene_label","cytoview" : "gene_label"},"key" : "ensembl","label_key" : "[biotype]","multi_name" : "GENCODE 26 Comprehensive gene set","name" : "Comprehensive Gene Annotations from GENCODE 26"}ikegami:
Output for 7.0.0 - 7.0.20, 7.1.0 - 7.1.25, 7.2.0 - 7.2.33, 7.3.0 - 7.3.31
Notice: Undefined variable: json_frament_from_api in /in/5XqUX on line 5 Alex Tartan: {"caption" : "Genes (Comprehensive set from GENCODE 26)","colour_key" : "[biotype]","default" : {"MultiBottom" : "collapsed_label","MultiTop" : "gene_label","alignsliceviewbottom" : "as_collapsed_label","contigviewbottom" : "transcript_label","contigviewtop" : "gene_label","cytoview" : "gene_label"},"key" : "ensembl","label_key" : "[biotype]","multi_name" : "GENCODE 26 Comprehensive gene set","name" : "Comprehensive Gene Annotations from GENCODE 26"}ikegami:

preferences:
161.24 ms | 403 KiB | 188 Q