Difference between PHP and PHP5 [closed] - php

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 8 years ago.
Improve this question
I want to study OOP-related PHP, mainly for mashups and some development. I started with PHP and MySQL.
What's the main relation or difference between PHP and PHP5. Is there anything different like PHP is for web development and the other PHP is for software development?
Please guide me with some books with PHP OOP examples and concepts...

Note: I am assuming by 'PHP to PHP5' you mean from PHP4 to PHP5. PHP5 is not a different languages from PHP, it is simply a different version.
PHP4 to PHP5
Here is the main differences between PHP4 and PHP5.
http://www.php.net/manual/en/migration5.php
The specific OOP changes are featured in the Object Model
http://www.php.net/manual/en/migration5.oop.php
One of the places that page points that will give you the basics to how OOP works in PHP would be the Classes and Object reference page:
http://www.php.net/manual/en/language.oop5.php
PHP Class Examples
If you want some specific examples of how OOP is used in PHP, you might want to look at my answer on some basic classes you might use in a web development setting:
https://stackoverflow.com/questions/2035449/why-is-oop-hard-for-me/2035482#2035482
Learning PHP
To learn PHP, you can do a search on PHP and OOP on StackOverflow, and the first few results give you resources to do so:
https://stackoverflow.com/search?q=php+oop
If you want to skip clicking the link, you can just go to http://php.net, cause I guarentee that almost all of them point there. PHP has one of the best documentations out there, and it is extremely easy to use, and you will return to it very, very often.
For the record, the first result talks about how to learn object-oriented programming in php.

PHP is a language. PHP 5 is a specific version of the language implementation, as opposed to 3, 4, or 6.
There are lots of alternatives to PHP. Almost any language can be used for web development via CGI, although it's more common to use a framework such as Django or Rails.

PHP5 removed register_globals, magic quotes, and safe mode. This was due to the fact that register_globals had opened security holes by intentionally allowing runtime data injection and the use of magic quotes had an unpredictable nature.

Related

Create a website with or without a framework like TYPO3? [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 7 years ago.
Improve this question
I hope my question fits in stackoverflow, let me explain my problem:
I am using to program websites in Java, Javascript, HTML, CSS and SQL in Eclipse for about 2 years. Now I want to create (alone) a pretty big community website in PHP (this program language is pretty new for me). In this context, I found the framework TYPO3 and try to learn it. After all I must say, that it seems very complicated to me and I can´t find the advantage over programming files strict in an normal editor without TYPO3. I'm in an inner conflict about whether this would be good or bad for my intention to create the website. I can´t find the benefits, but I often read, that they exist. Is Typo3 (or another framework for PHP) worth learning when you already have programming experience?
Note: Your question doesn't meet StackOverflow's requirements as it can produce many equally valid answers, here's my opinion from point of view of long term TYPO3 developer:
TYPO3 is great, well known, stable tool (btw. it's a CMS, not a framework) used for building thousand of sites of different size - from small product pages to big corporate portals. It brings lot of useful techniques and technologies just out-of-the-box, login forms, contact forms, user permissions, ready to use galleries, extensions, etc, etc... so you don't need to touch every single aspect of the web-programming as you get it just right after installing the system. It does matter especially when you are gonna to work alone - when you physically won't be able to concentrate on every aspect in any sensible time. For sure you'll get benefits using it instead writing it yourself - especially with your relatively short overall experience.
But is it best choice for your needs? I don't know, nobody can know it without analyzing your concept. TYPO3 may be to heavy for the task, it's the price for its flexibility, maybe you will need to use some faster framework, i.e. (TYPO3) Flow Framework (PHP, Framework for TYPO3's originally intended successor Neos CMS), Symfony (PHP) or Play Framework (Java) which also gives you great starting point, but requires more work on every element, maybe...
The only way to determine the valid path is to compare solutions yourself or order such a comparison from a qualified agency.
Laravel 5 is my favorite PHP framework. When you do understand this framework, it's so easy to manipulate routing (url), mysql logic, security, etc. I use it for every project with PHP. Try it, there's ton of tutorial out there!

Should I learn pure PHP before the Django framework? [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 9 years ago.
Improve this question
I've been coding with django for a few months now, and I have made good progress. But, I feel like I don't understand what's happening under the hood well enough to make the leap from beginner to advanced. For example, it's easy to manipulate the database via ORM in Django without having any knowledge of SQL. As another example, user authentication in Django almost only requires me to import a module and writing a couple of lines of code. I don't have to have any knowledge on sessions, database queries etc.
As I have done no prior web programming except Django, I was wondering if it would make sense to move to PHP (without a framework) and when I've learned the fundamental concepts of web development (cookies, sessions, SQL etc) return to Django development?
No, that wouldn't make any sense at all.
PHP is just one language for writing websites. It works in a certain way, but many of the things that you often see in PHP are not generally considered best practice. It's very unlikely to help you write a decent Python web app.
If you really want to learn how everything works, you could just as easily write a Python app using raw WSGI, or a micro-framework like Flask.

Event-Driven PHP Framework? [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 6 years ago.
Improve this question
I'm wondering if there are any completely event-drive frameworks out there for PHP which are based around dependency injection for decoupling. I know there are some frameworks that make use of these patterns - but in the end the entire life-cycle of the application is still pre-defined and linear in style.
For example, most frameworks are built to receive, process, and return results from HTTP requests. An event drive framework would have handlers for that, but also be able to be used for new purposes like background processing, command line interaction, or other non-standard use cases.
It sounds to me like the Photon framework fits closest to your description - the key point is that you can't have event-driven code without php running in a daemon-like process. Your choice of webserver in fact dictates whether what you ask is possible or not - photon is dependent on mongrel2.
I have never used it for a project personally, but I believe that Prado covers what you are asking. It is componentised, but I cannot be sure about the dependency injection aspect.
From their site:
PRADOTM is a component-based and event-driven programming framework for developing Web applications in PHP 5. PRADO stands for
PHP Rapid Application Development Object-oriented.
I know of it because one of my university class mates designed the logo and website for the project.
Not used it, but I believe in addition to Prado, which Treffynnon has mentioned, Qcodo is a pure event-driven framework.
I was looking what is around as well and i came across p4e which is based on zend framework,and nette, hope it can help!
Off the bat there are these 2 as well:
Zend Framework 2 (still in beta)
symfony 2
Both have all the things you are looking for I believe.
Symfony2. Simple as that.
http://symfony.com/
Yii ,It is a component based and event-driven framework, Pure OOP and MVC. It is very clean and neat. Check it out.
http://www.yiiframework.com
The Qbix Platform is heavily event-driven in PHP, although it does not use dependency injection.
Reactphp is what you are looking for.

What would you recommend as a transition language on the desktop for a PHP programmer? [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 3 years ago.
Improve this question
I've been using PHP for some time now, and though I certainly don't claim I am a PHP guru, I feel I know my way around the language enough to get most things done elegantly enough.
Up 'til now, I haven't really wanted to do much desktop programming. I've hacked together tiny things with AutoHotKey and (I'm sure) rather poorly written C#, but I have never gotten into these languages in the same way that I have with PHP.
Now, I'm looking to change that, so I am asking you guys what you think would be the best language for me to try for programming on the desktop. Preferably, I would like something that is
Typed similarly to PHP (Wikipedia lists it as "dynamically/weakly" typed
Interpreted
Can be compiled (or at least packed) to an executable, and easily
Thanks in advance for any help!
EDIT:
Thank you all for the helpful answers - I wish I could have accepted all of them. I decided to try learn into Python, keeping in mind the differences between web and desktop development. Thank you all for your generous help!
My recommendation would be to try python. It is dynamically/strongly typed, and has syntax and features relatively similar to php. It can't be compiled to an executable, but it can be compiled to byte-code, like java is.
I have been programming in php for several years and recently picked up python and have really enjoyed it. I have also used c++ and java quite a bit and find them to be more difficult to master, and more frustrating to use.
There's not much value is learning a "PHP for the desktop language". I'd recommend that you explore language with different principles (say Python or Ruby) and use Desktop apps as your learning vehicle. PHP is written to be embedded inside a web page and that carries over even when you use it as a regular scripting language.
You can learn the ropes a little before picking up a new language by using something like PHP GTK.
PHP's design principles are fine on server side, but in many places they don't really fit in the world of Desktop development. For example, native Windows applications follow entirely different paradigms. Being able to work with these in a PHP-like language requires an additional (performance-intensive) layer between your language and the Windows API.
Bottom line: Much of Desktop app programming is so fundamentally different from how a PHP web app works, you won't get far with PHP's paradigms anyway.
I would therefore recommend to drop the requirements, and look/ask for the optimal language for the task instead. I don't know your situation of course, but if you have the time, chance and inclination at all, it's a great way to expand the programming horizon; also from a professional and CV perspective, it doesn't hurt to have another language under your belt.

Web service API - which language is better? [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 8 months ago.
Improve this question
I wrote a web service API which services REST requests in php. It didn't take much time to actually setup this on apache. But, I am more comfortable writing python code rather than php code. Can python be used as a server-side scripting language like php? What changes are necessary to make it work with apache?
Thanks
Bala Mudiam
For a REST full API I would suggest that you take a look at Tornado. It's what Facebook uses. It's fast, efficient and easy to work with (written i Python). You may use nginx as a proxy in front of it to server static content and allow more Tornado services for scaling.
Python is a very capable server-side language. Large sites (such as AG Interactive) use Python for server-side programming and have had great results. mod_python and mod_wsgi are 2 popular modules for Apache that allow you to serve Python.
Yes Python can be used as server-side language (as well as Perl, Ruby or even C/C++). Just use mod_python for Apache http://www.modpython.org/
I'll dare to say that mod_wsgi is probably closer to the de-facto choice (vs. mod_python) if you're stuck with Apache as your web server these days. One benefit is that you'll find a wide range of active frameworks and libraries that are WSGI compatible. Please don't read too deeply into "framework" - some things I'd lump in there are quite minimal, providing a few nice conveniences on top of raw WSGI to help you organize your code. Imagining that you're not looking to invest into a web framework itself just to get a REST interface up, you might check out restish as an option.
In my opinion python which is a popular language is better.

Categories