11 ms·
PHP is NOT in any sense a framework. A framework is an abstraction built up USING a programming language, like PHP. In what way does PHP's standard library fa
by xd 16y ago
PHP is NOT in any sense a framework. A framework is an abstraction built up USING a programming language, like PHP.
In what way does PHP's standard library fall short that Python overcomes?
- IgorPartola 16y agoPHP's standard library provides function likes parse_str, headers and setcookie. It provides language constructs such as $_GET, $_POST, $_FILES, $_COOKIES, $_SESSION which are web specific. Its standard library comes geared towards outputting HTML and it provides a FastCGI process manager. I think most importantly, it provides a templating capability (albeit a very poor one), that is geared towards embedding dynamic content in HTML. It is by all means at least an attempt at a web framework. In what ways does PHP's standard library fall short of Python's? I was never comparing the two. I have always found that both could get the job done, except PHP's uses a very weak naming convention/has none at all. I was comparing PHP's standard library features with those of Django. Here, Django wins hands down. If you are not familiar with either, I recommend trying reading through their tutorials and seeing which one comes out with a more complete product in which one feels less messy. Lastly, implying that PHP's standard library is not a framework because it is not built in PHP ("A framework is an abstraction built up USING a programming language, like PHP.") is just plain wrong. If I decided to speed up Django by re-writing every line of its code in C and making it an extension to Python rather than a Python module, without breaking any function signatures, would Django cease being a web framework? What would it become then? What if instead of C I chose Visual Basic, or Common Lisp, or F#, or even PHP (assuming I found a decent way to compile it to a binary)? A framework is collection of code that abstracts certain functionality. See http://en.wikipedia.org/wiki/Software_framework http://en.wikipedia.org/wiki/Software_framework for further information. EDIT: I am not at all talking about PHP the language vs Python. The two are different and both have some very interesting features. PHP 5 has grown up to be a pretty interesting general purpose dynamic language. I am specifically talking about using PHP on the web.
- xd 16y agoI'm not sure where to begin with all this. It's late and been a long day so I will try and follow up most of this tomorrow morning. However, to your first set of points .. Where you call pre-populated global variables "language constructs". They are not. PHP calls them "super globals". These are global variables mapped from the GET/POST/Cookie client headers into the server environment by the PHP SAPI, for instance the Apache SAPI. PHP has many SAPIs, including a command line one, which doesn't populate these globals for obvious reasons. Oh and FastCGI for PHP is provided by a SAPI as well (nothing to do with the standard library). Oh and quickly - "I was comparing PHP's standard library features with those of Django." Can I pick a PHP framework of choice and start comparing it to Python?