Page 1 of 1
problem in type casting
Posted: Sat Apr 29, 2006 2:06 am
by itsmani1
I want to cast a real value to an int value and its giving me error
is there any solution it it?
Thanks
Re: problem in type casting
Posted: Sat Apr 29, 2006 2:14 am
by Chris Corbyn
itsmani1 wrote:I want to cast a real value to an int value and its giving me error
is there any solution it it?
Thanks
That's not cast notation, that's function notation. It should be:
Posted: Sat Apr 29, 2006 2:30 am
by itsmani1
Thanks much man.
Posted: Sat Apr 29, 2006 3:11 am
by Ollie Saunders
Obviously someone from a C++ background who doesn't know his C roots. Tisk tisk

Posted: Sat Apr 29, 2006 3:43 am
by Chris Corbyn
ole wrote:
Obviously someone from a C++ background who doesn't know his C roots. Tisk tisk

Note: There is a function that returns the integer value of it's argument.
intval()
Posted: Sat Apr 29, 2006 4:19 am
by Ollie Saunders
Why? Who exactly thought that function was a good idea?
I swear the PHP developers just like to bloat PHP
Posted: Sat Apr 29, 2006 4:58 am
by Chris Corbyn
ole wrote:Why? Who exactly thought that function was a good idea?
I swear the PHP developers just like to bloat PHP
It probably reads more logically to people who aren't well-versed in programming. Passing everything through functions is a lot easier to learn than getting to grips with various syntactical concepts. PHP attracts a lot of people who've never written a line of code in any other language before.
Posted: Sat Apr 29, 2006 6:27 am
by Ollie Saunders
why the hell didn't they call it int() then?!
And also this is another example of why
there should be two versions of php
Posted: Sat Apr 29, 2006 6:34 am
by timvw
ole wrote:I swear the PHP developers just like to bloat PHP
What's keeping you from doing it better then? It's not like that you can't fork your own php-done-good-this-time...
Posted: Sat Apr 29, 2006 8:05 am
by Ollie Saunders
What's keeping you from doing it better then? It's not like that you can't fork your own php-done-good-this-time...
Well yes it is. There is plenty stopping me
I went through a stage were I would design documents for new languages for fun but the whole process is really depressing because I don't have the time or ability to write my own language parsers. And I usually found as the years progressed my ideas showed weakness as others devised and implemented better solutions.
And anyway despite my complaints I love PHP and the annoyances are only small.