Show suggestion according to highlighted text position

Hi,
I’m using Languagetool API and trying to make a same UI(Editor) as of LT by using PHP. I have colored the first letter of wrong alphabet or grammar, even its replacing with wrong alphabet. And even showing those all replacements altogether once in the context-menu. I want to show specific replacements according to the specific word.
Through this code I’m getting replacements:

foreach ($json2['matches'] as $key=>$val) {                   //$json2 is getting API result. 
                        foreach ($val['replacements'] as $new=>$qwe) {
                        echo '<input type="button" value="'.$qwe['value'].'">';
                        }
                }

This is my current result:


Please let me know if I can get the position of each replacement according to its word in PHP.

Thanks

I’m not sure I understand the question, but if it’s about how to iterate the contents of a JSON file: this doesn’t seem to be specific to LanguageTool, I suggest you ask on a PHP forum instead.

1 Like

Okay, Thanks for your response.