Do you have a question? Post it now! No Registration Necessary. Now with pictures!
- Posted on
- php functions
- Jung, William
June 2, 2010, 6:37 pm
rate this thread
Is that true the PHP library is just a list of functions?
When i read sample PHP code, I don't seem to see any calls to init
Class objects like Java or C++ does
Is that most of the time, PHP will call functions only in the PHP
also, when calling PHP function, I don't seem to see the need to
include the source file contain the function like java and C++ does.
Is that true PHP do not need to include for the stand library?
Re: php functions
No need to create objects in procedural programming. Same in C++.
If you want to do some object-oriented programming you can create objects:
$c = new MyClass;
You don't need to include files if you just use built-in functions or
You can however put your own functions/classes in separate files and include
June 3, 2010, 7:49 am
Re: php functions
El 02/06/2010 20:37, Jung, William escribió/wrote:
PHP supports procedural programming, object-oriented programming and
whatever combination of both you are able to come with and built-in
functions are a reflection of this. Some (most?) of them offer
$foo = strlen($bar);
Some of them offer object-oriented style:
$foo = new SimpleXMLElement($bar);
And some of the offer *both*:
Apart from this, PHP does not have a clean concept of "library". All
available objects and functions are loaded into the global namespace.
You often "enable" and "disable" functionality by reconfiguring the
whole system so it loads or doesn't load the specific extension. You can
use function_exists() to guess whether an extension is loaded or not.
And you always need to be careful with your own code so you don't pick a
name that's already taken.
Yes, I know :)
-- http://alvaro.es - Álvaro G. Vicario - Burgos, Spain
-- Mi sitio sobre programación web: http://borrame.com
-- Mi web de humor satinado: http://www.demogracia.com
- » ssh on command line: force using a group size (prime size) of 1024 (and no...
- — The site's Newest Thread. Posted in » Secure Shell Forum