My code:
function count_words_display($speech, $articleid){
if (str_word_count($speech)>200){
$speech_short = implode(' ', array_slice(explode(' ', $speech), 0, 100)).'...<input type="button" id="read" value="Read more" onclick="myFunction("'.$articleid.'","'.$speech.'")">';
print $speech_short;
}
else{
print $speech;
}
}
I intend on getting output similar to this:
<input type="button" id="read" value="Read more" onclick="myFunction('24','Play')";>
However, I end up with this:
<input type="button" id="read" value="Read more" onclick="myFunction("24","Play")";>
Resulting in this error:
SyntaxError: expected expression, got '}'