simpson_121919 Posted February 14, 2011 Share Posted February 14, 2011 My main focus is creating websites. I know CSS and html and I know its time to learn a scripting language. It would be nice to have both a general purpose programming language and web scripting language under my belt. PHP No? Two birds one stone so to speak. So my question is would it be a good idea to use PHP for general purpose programming or just take the time to learn python also? Quote Link to comment https://forums.phpfreaks.com/topic/227604-is-php-practical-for-general-purpose-programming/ Share on other sites More sharing options...
gizmola Posted February 14, 2011 Share Posted February 14, 2011 It depends on the task, but in general, PHP is mainly a web development language. Quote Link to comment https://forums.phpfreaks.com/topic/227604-is-php-practical-for-general-purpose-programming/#findComment-1173949 Share on other sites More sharing options...
simpson_121919 Posted February 14, 2011 Author Share Posted February 14, 2011 I see. Well considering I have no tasks at hand for programming I cant ask if this would be good for a given situation. How about Python, is it powerful when it comes to web development. I really really want to kill two birds with one stone. Quote Link to comment https://forums.phpfreaks.com/topic/227604-is-php-practical-for-general-purpose-programming/#findComment-1173953 Share on other sites More sharing options...
trq Posted February 14, 2011 Share Posted February 14, 2011 Python is an awesome programming language which has been well thought out, designed and is allot more versatile than PHP simply because there are allot more system programming libraries around. Really though, PHP remains a pretty big contender on the web. Ruby might also be something you might want to look into. It's also a very well designed language, is well web enabled via Rails and is also quite versatile. It's still quite young compared to Python though so there's not quite the amount of libs around but it is quickly catching up. There is always Perl too, though I wouldn't use it for the web. It really depends on what you want to program exactly. Are you a windows user? You might be better off taking a look at C# & .Net. Quote Link to comment https://forums.phpfreaks.com/topic/227604-is-php-practical-for-general-purpose-programming/#findComment-1173954 Share on other sites More sharing options...
simpson_121919 Posted February 14, 2011 Author Share Posted February 14, 2011 Python is an awesome programming language which has been well thought out, designed and is allot more versatile than PHP simply because there are allot more system programming libraries around. Really though, PHP remains a pretty big contender on the web. Ruby might also be something you might want to look into. It's also a very well designed language, is well web enabled via Rails and is also quite versatile. It's still quite young compared to Python though so there's not quite the amount of libs around but it is quickly catching up. There is always Perl too, though I wouldn't use it for the web. It really depends on what you want to program exactly. Are you a windows user? You might be better off taking a look at C# & .Net. Thanks for the help. I will be using linux and thats what had me leaning towards php and python. With python do I get the best of both worlds(general purpose programming and web development)? Quote Link to comment https://forums.phpfreaks.com/topic/227604-is-php-practical-for-general-purpose-programming/#findComment-1173959 Share on other sites More sharing options...
trq Posted February 14, 2011 Share Posted February 14, 2011 There are web frameworks around for Python, and there is also mod_python. I would say however that it is more of a general purpose language when compared to something like PHP. Quote Link to comment https://forums.phpfreaks.com/topic/227604-is-php-practical-for-general-purpose-programming/#findComment-1173976 Share on other sites More sharing options...
simpson_121919 Posted February 14, 2011 Author Share Posted February 14, 2011 Got it. Thanks Quote Link to comment https://forums.phpfreaks.com/topic/227604-is-php-practical-for-general-purpose-programming/#findComment-1174233 Share on other sites More sharing options...
gizmola Posted February 18, 2011 Share Posted February 18, 2011 I would really question what it is that you are going to be doing most of the time. Python can be bent to do Web development, although it is not as well suited to that as PHP. It's used a lot in academia and by scientists. I'm not sure exactly why that is, but I suspect that some of the things I don't like about Python are the very reason people who aren't primarily programmers like it. For example, in Python, indentation of code is important. In fact, you really have to configure your editor so that it uses spaces instead of tabs, and things like that. It's logical, and I guess you could argue that it's terse and efficient not to have to have block delimiters, but I'd rather not have a program not work because I typed an extra space somewhere. As for php, the biggest issue I've seen with it is in people trying to do socket servers and things of that nature. The routines in the language are flakey enough that people regularly avoid them and use curl to for example, connect to a web service or server, even those capabilities are baked right into the file handling routines. PHP doesn't for example, seem to make a great platform for the development of an irc bot, whereas, python does. With that said, you can probably get by with making either language your general purpose language, but I'd certainly consider which task I believe I'll be doing more of and make my decision based on that, rather than which one is more of a swiss army knife. Sure a swiss army knife could be used to dig a ditch, but if you're mostly digging ditches I'm sure you'd rather have a shovel. Quote Link to comment https://forums.phpfreaks.com/topic/227604-is-php-practical-for-general-purpose-programming/#findComment-1176100 Share on other sites More sharing options...
trq Posted February 18, 2011 Share Posted February 18, 2011 It's used a lot in academia and by scientists. I'm not sure exactly why that is, but I suspect that some of the things I don't like about Python are the very reason people who aren't primarily programmers like it. I think the reason it's (Python) used allot in academic situations is because it is very clean and easy to see the point of a programs functionality. Python definitely stretches far beyond that however, entire OS infrastructures are built around it these days (see Portage) and most (if not all) Linux distributions depend on it being installed by default. As for php, the biggest issue I've seen with it is in people trying to do socket servers and things of that nature. The routines in the language are flakey enough that people regularly avoid them and use curl to for example, connect to a web service or server, even those capabilities are baked right into the file handling routines. I'm not sure how substantiated these clams are either. Iv'e seen (and used) web servers written in php (see Nanoweb) that are certainly robust enough to run most personal web sites. Quote Link to comment https://forums.phpfreaks.com/topic/227604-is-php-practical-for-general-purpose-programming/#findComment-1176155 Share on other sites More sharing options...
gizmola Posted February 19, 2011 Share Posted February 19, 2011 The claim is basically from my own experience working on an irc bot, and the fact that it was never really stable, but you can certainly see plenty of other complaints when you read about the file wrappers and issues that they have. With that said, I know work has been done on the socket routines to make them better. I don't personally think a web server is a good example, due to the request/response nature of php, but I have always thought nanoweb is a cool project, and I'm sure a lot could be learned from looking at its code. Quote Link to comment https://forums.phpfreaks.com/topic/227604-is-php-practical-for-general-purpose-programming/#findComment-1176620 Share on other sites More sharing options...
possien Posted March 1, 2011 Share Posted March 1, 2011 I really like PHP but it's main purpose is to produce html. I am beginning to like Ruby and Ruby on Rails. You can interface with other applications both on linux and windows. Quote Link to comment https://forums.phpfreaks.com/topic/227604-is-php-practical-for-general-purpose-programming/#findComment-1181089 Share on other sites More sharing options...
chris.smith Posted March 27, 2011 Share Posted March 27, 2011 My main focus is creating websites. I know CSS and html and I know its time to learn a scripting language. It would be nice to have both a general purpose programming language and web scripting language under my belt. PHP No? Two birds one stone so to speak. So my question is would it be a good idea to use PHP for general purpose programming or just take the time to learn python also? If your application needs to communicate with the web then yes, php can be adjusted to just about every web situation. Moreover Facebook recently released a tool called HipHop that can convert your php scripts into high-speed c++ binaries. Quote Link to comment https://forums.phpfreaks.com/topic/227604-is-php-practical-for-general-purpose-programming/#findComment-1192904 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.