You are here: Re: PHP6 - Comments? « PHP Programming Language « IT news, forums, messages
Re: PHP6 - Comments?

Posted by Oliver Gr�tz on 08/24/05 05:20

NC schrieb:

> Fortunately, we are not there yet. OOP can still be avoided
> if necessary. Reading a remote file still can be done in a
> single file_get_contents(),

OOP always seems to be "the bad guy". Sure, I like file_get_contents(),
especially if it's "file_get_contents('http://www.google.com');", but
what is so bad with

$myfile=new File('my-article.txt');
foreach($myfile as $line)
{
// do stuff
}

> as opposed to spawning a
> HttpWebRequest/WebResponse pair in VB.NET. Most importantly,
> string is still not an object.

What is so bad about

$s=new String('this is a test');
echo $s->reverse();

against

$s='this is a test';
echo strrev($s);

It's absolutely the same. But the String class could tell you about it's
capabilities:

print_r(get_class_methods('String'));

The only thing bad about strings being objects is having to write more
code. In Ruby this isn't true, since strings are first class objects and
you can actually call methods on the strings:

print "this is a test".reverse

Even numbers are objects and they've got handy methods:

5.times print "Hello."

Objects are good. Period.


AllOLLi

 

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

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