<?php $data = ["Single 'quotes' and double \"quotes\""]; $escaped_data = json_encode( $data, JSON_HEX_QUOT|JSON_HEX_APOS ); $escaped_data = str_replace("\u0022", "\\\"", $escaped_data ); $escaped_data = str_replace("\u0027", "\\'", $escaped_data ); echo "var value = JSON.parse(JSON.stringify('{$escaped_data}'));";
You have javascript disabled. You will not be able to edit any code.