【问题标题】:If conditions with hebrew letter [duplicate]如果条件带有希伯来字母[重复]
【发布时间】:2012-12-13 11:40:15
【问题描述】:

可能重复:
Split the first letter from variable

我有代码:

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

如果我想将“我”改为希伯来字母,我该怎么做? 如果我想检查范围

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

if 中我是怎么做的?

【问题讨论】:

  • a 和 b 之间可以有一个字母吗?
  • if($firstletter=='א') 可能吗?
  • 如果($firstletter'a') 有可能吗?
  • Idan - if($firstletter=='א') 是完全可能的......但是你是怎么得到 $firstletter 的
  • $firstletter = $userData['name'][0];

标签: php character-encoding


【解决方案1】:

假设 UTF-8 字符集

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

或修改为合适的字符集

【讨论】:

  • 谢谢你,但是如果我这样做了,我也用英文字母可以吗?
  • 不行,不.... א !== a,要进行这种类型的比较,您需要将希伯来语字符转换为英文字符
  • 不,你不明白我的意思,我的意思是如果我在 if more if 后面加上 $firstletter=='a' 就可以了吗?
  • 你的意思是如果 ($firstletter=='א' || $firstletter=='a') { 那么是的,没关系
  • 如果我写 if($firstletter>'a' && $firstletter
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2015-08-09
  • 1970-01-01
  • 2012-02-03
相关资源
最近更新 更多