php-general Digest 31 Oct 2012 16:27:54 -0000 Issue 8027

2012-10-31 Thread php-general-digest-help
php-general Digest 31 Oct 2012 16:27:54 - Issue 8027 Topics (messages 319624 through 319637): Multithreading for OOP PHP 319624 by: Florian Müller 319626 by: marco.behnke.biz 319627 by: Ovidiu Farauanu 319628 by: Ovidiu Farauanu 319629 by: Florian

[PHP] Multithreading for OOP PHP

2012-10-31 Thread Florian Müller
Hi guys I was wondering, what actually the reason is that PHP itself does not support multi-threading? I guess this would be realizable, or not? If not, why? Maybe this is a stupid question, but still somehow interesting. Realization in a way as Java does (or just something in that way) would

Re: [PHP] TURBOPY cloud framework + IDE beta available NOW

2012-10-31 Thread ma...@behnke.biz
Johannes Reichardt johannes.reicha...@googlemail.com hat am 30. Oktober 2012 um 16:37 geschrieben: In times of testability and several design patters, the use of static calls is really outdated. I understand that you can read and write the invocations of the methods much faster, but

Re: [PHP] Multithreading for OOP PHP

2012-10-31 Thread ma...@behnke.biz
Florian Müller florian-muel...@outlook.com hat am 31. Oktober 2012 um 07:58 geschrieben: Hi guys I was wondering, what actually the reason is that PHP itself does not support multi-threading? I guess this would be realizable, or not? If not, why? Maybe this is a stupid question, but still

[PHP] Multithreading for OOP PHP

2012-10-31 Thread Ovidiu Farauanu
Hello Florian, Usually you want to run a PHP script in two different environments: 1. inside a webserver 2. in a command line interface For a web application, the application server does the work for you. It is the server job to have a thread pool and balance it correctly. So you don't need

[PHP] Multithreading for OOP PHP

2012-10-31 Thread Ovidiu Farauanu
Yes Marco has right. But more than that, OOP is mainly designed to run in a single threaded environment and it is not the best idea to be used for concurrent programming because you will need synchronization everywhere and this slows down the code, but also ask for a lot of other troubles. I

RE: [PHP] Multithreading for OOP PHP

2012-10-31 Thread Florian Müller
I actually tought about just the same structures as Java uses(something in this way: Thread t = new Thread(new Runnable() {public void run() {...blabla }} I thought this would actually be a good benefit if PHP supported this. It's just as we sometimes use PHP for doing some big

Re: [PHP] Multithreading for OOP PHP

2012-10-31 Thread ma...@behnke.biz
Ovidiu Farauanu ovidiugabr...@gmail.com hat am 31. Oktober 2012 um 09:59 geschrieben: Hello Florian, Usually you want to run a PHP script in two different environments: 1. inside a webserver 2. in a command line interface For a web application, the application server does the work for

Re: [PHP] Multithreading for OOP PHP

2012-10-31 Thread ma...@behnke.biz
Ovidiu Farauanu ovidiugabr...@gmail.com hat am 31. Oktober 2012 um 09:59 geschrieben: Yes Marco has right. But more than that, OOP is mainly designed to run in a single threaded . I don't put a comment on that. environment and it is not the best idea to be used for concurrent

[PHP] Re: Multithreading for OOP PHP

2012-10-31 Thread Alessandro Pellizzari
Il Wed, 31 Oct 2012 11:57:11 +0100, ma...@behnke.biz ha scritto: But it if PHP would be threadsafe, you would be able to run the Apache in a much faster and less memory using way. There once was a configure option in PHP to compile it threadsafe, but they dropped it for a reason. Because PHP

[PHP] Re: Multithreading for OOP PHP

2012-10-31 Thread Alessandro Pellizzari
Il Wed, 31 Oct 2012 11:50:00 +0100, ma...@behnke.biz ha scritto: The drawback of forking is the memory overhead. With every fork you take the same amount of memory which is not the case if you could use real threads. No, it is not. Forking in Linux uses COW (copy-on-write), so a

Re: [PHP] Re: Multithreading for OOP PHP

2012-10-31 Thread Alex Nikitin
Hey guys (and/or gals), I have heard this question entirely too many times, I think at some point Rasmus just stopped responding to it. The real reason that PHP is not threaded has nothing to do with PHP internal or extension thread safety, the reason is more to the extent that it doesn't make

Re: [PHP] Re: Multithreading for OOP PHP

2012-10-31 Thread Tommy Pham
On Wed, Oct 31, 2012 at 6:46 AM, Alex Nikitin niks...@gmail.com wrote: Hey guys (and/or gals), I have heard this question entirely too many times, I think at some point Rasmus just stopped responding to it. The real reason that PHP is not threaded has nothing to do with PHP internal or

Re: [PHP] Re: Multithreading for OOP PHP

2012-10-31 Thread Alex Nikitin
That's all understood but there are times when that one request from the visitor requires many sub-requests like connection to DB and making SOAP calls. I would say it's more than just there are times, that's how a typical script lives, it imports libraries, queries the database, and talks

Re: Re: [PHP] TURBOPY cloud framework + IDE beta available NOW

2012-10-31 Thread Adam Richardson
On Tue, Oct 30, 2012 at 7:33 AM, ma...@behnke.biz ma...@behnke.biz wrote: In times of testability and several design patters, the use of static calls is really outdated. I understand that you can read and write the invocations of the methods much faster, but you should think more to the

Re: [PHP] Multithreading for OOP PHP

2012-10-31 Thread Larry Garfield
On 10/31/12 1:58 AM, Florian Müller wrote: Hi guys I was wondering, what actually the reason is that PHP itself does not support multi-threading? I guess this would be realizable, or not? If not, why? Maybe this is a stupid question, but still somehow interesting. Realization in a way as Java

Re: [PHP] Multithreading for OOP PHP

2012-10-31 Thread Matijn Woudt
On Wed, Oct 31, 2012 at 11:37 AM, Florian Müller florian-muel...@outlook.com wrote: I actually tought about just the same structures as Java uses(something in this way: Thread t = new Thread(new Runnable() {public void run() { ...blabla }} I thought this would actually be a

Re: [PHP] Re: Multithreading for OOP PHP

2012-10-31 Thread Tommy Pham
On Wed, Oct 31, 2012 at 9:27 AM, Alex Nikitin niks...@gmail.com wrote: That's all understood but there are times when that one request from the visitor requires many sub-requests like connection to DB and making SOAP calls. I would say it's more than just there are times, that's how a

[PHP] ZendCodeAnalyzer oddity

2012-10-31 Thread Christoph Boget
Consider the following code: ?php class bob { static function factory() { echo 'In factory!br'; } } bob::factory(); $var = 'bob'; $var::factory(); ? When I run this, In Factory! is displayed twice, as I would expect. So by all accounts, there's nothing wrong with the code.

Re: [PHP] TURBOPY cloud framework + IDE beta available NOW

2012-10-31 Thread Marco Behnke
Am 31.10.12 18:13, schrieb Adam Richardson: On Tue, Oct 30, 2012 at 7:33 AM, ma...@behnke.biz ma...@behnke.biz wrote: In times of testability and several design patters, the use of static calls is really outdated. I understand that you can read and write the invocations of the methods much

Re: [PHP] TURBOPY cloud framework + IDE beta available NOW

2012-10-31 Thread Marco Behnke
Am 31.10.12 18:13, schrieb Adam Richardson: While OOP is one way to approach programming, it's not the only way. Even Rasmus has said he leans procedurally: http://toys.lerdorf.com/archives/38-The-no-framework-PHP-MVC-framework.html Found another interesting discussion on that topic:

Re: [PHP] Multithreading for OOP PHP

2012-10-31 Thread Dotan Cohen
It's just as we sometimes use PHP for doing some big Server works (e.g. database copying or something) and it would be nice to controll by yourself which Thread (or process) does which part of the job. I don't suppose that the client is sitting there waiting for a reply until the browser

Re: [PHP] Re: Multithreading for OOP PHP

2012-10-31 Thread Alex Nikitin
You do all that in the context of a single PHP instance and linear code, calling curl_multi handles its own threading, you just get back results, you dont have to store it anywhere outside PHP memory space, and you can configure timeouts and all that stuff, or you can regulate it yourself. The

Re: [PHP] TURBOPY cloud framework + IDE beta available NOW

2012-10-31 Thread Adam Richardson
On Wed, Oct 31, 2012 at 4:46 PM, Marco Behnke ma...@behnke.biz wrote: 1. If you have code using static methods and members and use phpunit for testing it, you have to either make sure, that everything is properly resetted after use OR have to run phpunit in a mode where every test is run in

Re: [PHP] ZendCodeAnalyzer oddity

2012-10-31 Thread tamouse mailing lists
On Wed, Oct 31, 2012 at 3:42 PM, Christoph Boget christoph.bo...@gmail.com wrote: Consider the following code: ?php class bob { static function factory() { echo 'In factory!br'; } } bob::factory(); $var = 'bob'; $var::factory(); ? When I run this, In Factory! is