PHP 5.0.4中的类型转换问题 [英] Typecast problem in PHP 5.0.4
本文介绍了PHP 5.0.4中的类型转换问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我使用以下代码片段将一个对象与整数进行比较
我的脚本。
if($ forecast [''day_sequence'']< 4){
我得到了细分错误在CLI中执行此
脚本时出现错误消息。经过调试后,我将代码更改为
if((int)$ forecast [''day_sequence'']< 4){
及其运作良好。所以它意味着我的php版本不会自动进行类型转换
。
这是真的吗?
- -
Mani
Hi,
I am using the following snippet to compare an object with integer in
my script.
if ( $forecast[''day_sequence''] < 4 ) {
I got the "segmentation fault" error message when i executed this
script in CLI. After debugging, i had changed my code to
if ( (int) $forecast[''day_sequence''] < 4 ) {
and its worked well. So its means my php version dont do typecasting
automatically it seems.
Is it true?
--
Mani
推荐答案
forecast [''day_sequence'']< 4){
我得到了分段错误在CLI中执行此
脚本时出现错误消息。调试后,我已将代码更改为
if((int)
forecast[''day_sequence''] < 4 ) {
I got the "segmentation fault" error message when i executed this
script in CLI. After debugging, i had changed my code to
if ( (int)
forecast [''day_sequence'']< 4){
,效果很好。所以它意味着我的php版本不会自动进行类型转换
。
这是真的吗?
- -
Mani
forecast[''day_sequence''] < 4 ) {
and its worked well. So its means my php version dont do typecasting
automatically it seems.
Is it true?
--
Mani
***Manikandannescribió/写(2006年8月30日04:43:29 -0700):
*** Manikandan escribió/wrote (30 Aug 2006 04:43:29 -0700):
if(
这篇关于PHP 5.0.4中的类型转换问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文