In php I want to simply find the percent in string value such as 33%
. This below code works fine:
echo strpos("%", '33%') == true
? '33%'
: '33' . '$';
but then when I put this percent into a variable, strpos()
it doesn't work correctly, for example:
$move_money_data = '33%';
echo strpos("%", $move_money_data) == true
? $move_money_data
: $move_money_data . '$';
I think the code is correct, but I don't know why when I put it into a variable, the result is not correct.