You are here: Re: Typecast problem in PHP 5.0.4 « PHP Programming Language « IT news, forums, messages
Re: Typecast problem in PHP 5.0.4

Posted by Alvaro G. Vicario on 08/31/06 18:35

*** Manikandan escribió/wrote (30 Aug 2006 04:43:29 -0700):
> 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?

Nope. A segmentation fault is normally a bug in the PHP interpreter or some
other system library. Bad code may help to trigger it some times but it's
always an unexpected result: ideally, PHP should complain if necessary but
not crash.

I've tried this code:

<?php

class Foo{
}

$foo=new Foo();

if($foo < 4){
echo "foo is less than four\n";
}

?>

The condition is true and it also raises a notice: "Notice: Object of class
Foo could not be converted to int"

--
-+ http://alvaro.es - Álvaro G. Vicario - Burgos, Spain
++ Mi sitio sobre programación web: http://bits.demogracia.com
+- Mi web de humor con rayos UVA: http://www.demogracia.com
--

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация