Announcement

Collapse
No announcement yet.

Why so many built-in functions for PHP?

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • version2
    replied
    Originally posted by Michael
    I haven't used PHP for a while, but from memory you can't use pointers which are needed to do things such as linked-lists, binary trees, graphs etc.
    PHP doesnt need this IMO. When you get into this arena then you have to start worrying about garbage collection, and protection of memory. PHP is pretty robust and can do what it is designed to do. And yes, I am a big C/C++ fan.

    Leave a comment:


  • Michael
    replied
    Originally posted by Cyborg from DH
    I think one reason for a lot of the built-in functions is to keep the speed up, because it is faster for PHP to run the function in C than it is to interpret all of your code to run the function for you.
    You are actually spot on here. C++ allows you to use pointers etc which allow you to design abstract data types such as trees. For things such as searching in C++ you can setup a binary search tree and search using logarithmic efficiency.

    I haven't used PHP for a while, but from memory you can't use pointers which are needed to do things such as linked-lists, binary trees, graphs etc. You are much better off using the built in functions then your own ones.

    Leave a comment:


  • version2
    replied
    Its the perl/php wars! w00t!

    Leave a comment:


  • CeleronXT
    replied
    Having all of the functions built in generally allows you to "code for PHP" and you're basically guaranteed everything will work on almost all installations of PHP.

    As opposed to something like perl where there's countless modlues, you actually "code for Perl with modlues a, b, c, d, e, f, g, h, i, and j installed" where your end users may have to download and install extra modules for it to function properly.
    Last edited by CeleronXT; Fri 23 May '03, 3:48pm.

    Leave a comment:


  • Chaos_Theory
    replied
    You have quite a goal, i suggest learning a little of everything at first. then broaden your horizen to more advanced aspects of each programing language.

    Leave a comment:


  • Cyborg from DH
    replied
    I think one reason for a lot of the built-in functions is to keep the speed up, because it is faster for PHP to run the function in C than it is to interpret all of your code to run the function for you.

    Leave a comment:


  • DestyNova
    replied
    gregc, I am C++ programmer too, there are lots of similiars in C/C++ and PHP. It is good and nice language for everyone who wants to learn C or C++ but have hard time to learn usually will learn better if they try PHP before C or C++. That is a major positive in that.

    As for Perl, it is ..decent language but I found it odd compare to C or PHP. IMHO anyway. http://www.bbspot.com/News/2001/03/perl_test.html .. I wonder about Perl itself sometimes.

    Leave a comment:


  • gregc
    replied
    thanks so much for all the replies...

    Thanks so much everyone! lol, I'd learn PERL, but as it is I'm already learning Intermediate/Advanced PHP, MySQL, and C++ - so I'm a bit overloaded right now. Also I've got to graduate out of highschool in a year so things are pretty hectic right now (I'm 14 as of this moment).

    Yeah, I will get around to learning PERL, but I'll probably be learning more C++ in a College after I get out of Highschool as Valedictorian - but I want to learn XML too. Oh yeah, and Java too to add to the collection :-)

    Gregory C.

    Leave a comment:


  • Mark Hensler
    replied
    whoops, someone beat me

    Leave a comment:


  • Mark Hensler
    replied
    krs-one, ever hear of PEAR?
    "PEAR is a code repository for PHP extensions and PHP library code inspired by TeX's CTAN and Perl's CPAN."

    Leave a comment:


  • Karl
    replied
    The one advantage of functions in the langauge is that they will be executed faster as they don't have to be interpretted, e.g. the DBI for perl has to be interpretted before running, wheras the DB functions in PHP are ready to roll so to speak.

    PHP does have a lot of functions, but what you have to remember is that most are not compiled in by default and quite a few of them are for niche areas, so it's not a case of not having to write your own functions.

    PHP does have an equivelant of CPAN, it has PEAR but it's just not as popular by a long way yet.

    Leave a comment:


  • krs-one
    replied
    actually

    Actually, "Perl is designed to make the easy jobs easy and the hard jobs possible. -Larry Wall"

    Hah. Nah, Perl is an awesome language that allows you to do anything from basic string manipulation to OpenGL programming.

    Perl was not designed for the web, as PHP was, so you will find it not as easy to use sometimes.

    Perl, unlike PHP (yet), has a place called CPAN, or Comprehensive Perl Archive Network, where people have gone and submitted source code and modules. There are over 2500 modules, and you will most likely be able to find one that suits your needs.

    Several well known modules:

    The NET modules
    The LWP modules
    The Perl DBI
    The Socket modules

    Anyway, Perl is probably best known as the first language to fully implement regular expressions, well. Larry Wall, who is a best, btw, originally wrote perl (notice the small caps, Perl the language is capitalized, perl the interpreter is not) back in 1987, and it has grown to a user base of more than a million people.

    Right now, there is a group, called the p5p, or Perl 5 Porters, that work on porting perl, along with updating it and so forth.

    In your quest to learn Perl, you should do several of the following:

    1. visit www.perl.com
    2. purchase Programming Perl III Edition, by Larry Wall, Randal Schwartz, and Tom Christiansen from O'Reilly and Associates. Best Perl book out there.
    3. Look at other O'Reilly perl titles, and decide which other ones will suit your needs.
    4. Keep asking questions.
    5. Visit www.tek-tips.com. Another forum that has several sub forums on Perl, which I am one of the Masters of , and the other Masters can help you there. Very good site.

    Thats about all I have to say, anyone else care to add more?

    -Vic

    Leave a comment:


  • Mark Hensler
    replied
    Actually its "Practical Extraction and Report Language".

    Perl.com says this:
    "Perl is a language optimized for scanning arbitrary text files, extracting information from those text files, and printing reports based on that information."

    Leave a comment:


  • gregc
    replied
    Yeah, the number of PHP functions is pretty ridiculous....

    Even though PHP is my second favorite language (C++ is my favorite) and PHP is fun to use, but the funtions are pretty ridiculous...

    I think it would save time if the functions were in a .h file - like iostream.h or something...

    While I'm here, does anyone know why PERL is named PERL? I know PERL stands for "Practical Extractable and Report Language" but that doesn't really cut it for me. What does Practical Extractable and Report Language mean? Report what? Extract what?

    Gregory C.

    Leave a comment:


  • JamesUS
    replied
    Don't forget that not all the functions mentioned on php.net will be compiled in to your install...when PHP is compiled you specify what features you need and those functions are compiled in.

    Leave a comment:

widgetinstance 262 (Related Topics) skipped due to lack of content & hide_module_if_empty option.
Working...
X