Guest Deleted Posted December 1, 2014 Share Posted December 1, 2014 You know how there are events in JavaScript? Is there anything comparable to that in PHP? Can a server-side language even have events? Link to comment Share on other sites More sharing options...
HartleySan Posted December 2, 2014 Share Posted December 2, 2014 There are no events, per se, but there are callback functions for things like ob_start, etc. If you think about it though, events don't mean as much for a server-side language, although server-side languages like Node.js utilize event-like structures for things (since Node.js is intended to function like JS on the server side). Link to comment Share on other sites More sharing options...
Larry Posted December 2, 2014 Share Posted December 2, 2014 When I think of events/not-events, I look at whether the thing is constantly running or not. Desktop applications, mobile applications, and web applications (with JavaScript) are constantly running, so they react to events. A PHP script is requested, executes, and then stops. In theory there are event-y things during execution, but the PHP script doesn't continue to run after completion, so it's not watching for or listening for events the way JavaScript is in the web browser. Link to comment Share on other sites More sharing options...
Guest Deleted Posted December 3, 2014 Share Posted December 3, 2014 Enlightening. Thanks guys. And speaking of Node.js, what is you guy's opinion on that? I hear people saying it's going to replace PHP. Do you guys think it will? Link to comment Share on other sites More sharing options...
HartleySan Posted December 3, 2014 Share Posted December 3, 2014 No, I don't. It's "fun" and can be used to create real applications, but I don't think it'll ever replace PHP. Link to comment Share on other sites More sharing options...
Larry Posted December 4, 2014 Share Posted December 4, 2014 It's not going to replace PHP. Although Node.js (and NPM) is being used more and more as an installer. But I think Nginx has a better chance of overtaking Apache than Node.js has of overtaking PHP. Link to comment Share on other sites More sharing options...
Guest Deleted Posted December 4, 2014 Share Posted December 4, 2014 Thanks for the answers guys. It's good to hear that my language of choice should be around for awhile longer So, what do you think it is about PHP that has allowed it to remain so popular? Do you consider any of the following to be reasons:-More friendly to beginning programmers than are many other languages-Most hosting plans support it-You have things like XAMPP which let you easily create a web server environment on your computer-Can easily find books, tutorials, stack overflow questions etc. about almost anything you could want to know-Lots of other people code in PHP, so there are lots of people to ask questions-Updated like every year (not sure how to word this but I noticed PHP 5.4 came out one year, next year 5.5, next year 5.6, etc.)-Has some good frameworks Link to comment Share on other sites More sharing options...
Recommended Posts