I am attempting to echo a Tweet button in a table and have the tweet text from a json_array response.
The following code work unless the json response has a single quote(apostrophe) in it.
If the response has a single quote ( example I'm unhappy) this breaks the tweet text and stops after the I
is there away to strip all single quoyes from an array? or is there a better way to do what I am trying to accomplish?
echo "<table border='0'>";
echo "<tr><td><a href='https://twitter.com/share' class='twitter-share-button'{count} data-text='";
echo $json_array["reasons"][0]["author_name"], "says ", $json_array["reasons"][0]["content"];
echo " data-via='OnRecall' data-hashtags='OnRecall'>Tweet</a></td></tr>";
echo "<tr><td>Name: </td><td>", $json_array["reasons"][0]["author_name"];
echo " -> Liked: ", $json_array["reasons"][0]["like_count"], " times.</td></tr>";
echo "<tr><td width= '20'></td><td>", $json_array["reasons"][0]["content"];
echo "</td></tr></table><p><hr></hr></p>";
So if $json_array["reasons"][0]["content"] has a single quote in it, the tweet text stops at it.
Thank you for reading.