If conditions with hebrew letter [duplicate]

2019-09-29 04:41发布

Possible Duplicate:
Split the first letter from variable

i have code:

if($firstletter=='I')
{
     $picture = ImageCreateFromPNG ($global['maleBackgroundImages'][5]);
}
else
{
     $picture = ImageCreateFromPNG ($global['maleBackgroundImages'][4]);
}

If I want to change the 'I' to hebrew letter how I do it? and if I want to check range

$firstletter>a **and** $firstletter<b 

how I do it in the if?

1条回答
Viruses.
2楼-- · 2019-09-29 04:52

Assuming UTF-8 character set

$firstletter = mb_substr($userData['name'], 0, 1, 'UTF-8');
if ($firstletter=='א') {
    ...
}

or modify for the appropriate character set

查看更多
登录 后发表回答