arrays - Php if elseif loop is not working fine
Get the solution ↓↓↓Solution:
Issues in the above code, There is no need of end().
<?php
$neg_words= array('not good',
'poor',
'late',
'wrong');
$sug_words=array('would',
'should',
'suggestion',
'want');
$pos_words=array('Great',
'great',
'good',
'smile',
'pleasant',
'interesting',
'pleasing',
'nice',
'happy',
'love',
'like',
'loving',
'liking',
'amazing');
$string = 'I like the way';
$strings =explode(' ', $string);
if (array_intersect($strings,$neg_words))
echo "Negative";
elseif (array_intersect($strings,$sug_words))
echo "Suggestion";
elseif (array_intersect($strings,$pos_words))
echo "positive";
else
echo "Neutral";
?>
Share solution ↓
Additional Information:
Link To Answer People are also looking for solutions of the problem: trying to access array offset on value of type bool
Didn't find the answer?
Our community is visited by hundreds of web development professionals every day. Ask your question and get a quick answer for free.
Similar questions
Find the answer in similar questions on our website.
Write quick answer
Do you know the answer to this question? Write a quick response to it. With your help, we will make our community stronger.