Re: [PHP] Node.PHP

2012-03-30 Thread Michael Save
Because "normal" PHP is not asynchronous.

Also, I kind of doubt you can outperform node.js with standard PHP.

On Sat, Mar 31, 2012 at 11:56 AM, German Geek  wrote:
> Maybe stupid question, but is node.php really necessary? If you can program
> PHP and it performs better than node.js, why would you need to have another
> wrapper around things. Why not just program "normal" PHP?
>
> twitter: geekdenz
> Blog: http://www.thheuer.com
>
> On Sat, Mar 31, 2012 at 10:39 AM, Hiyarli Baba  wrote:
>>
>> As like Micheal's said said just keep up alive the project
>> I was preferes node.js to pho only when i needed send millions of ssl
>> api requests.
>> nodejs sends 1k https request in onky 2 second including parsing
>> required elements from database , check the returned source write to
>> file
>>
>> if you want develope / clone more modules for that please start from
>> http|s.req :p and let me coninue at php
>>
>> http://stackoverflow.com/a/9199961 my nodejs + php thing
>>
>> 2012/3/22, Michael Save :
>> > Very nice!
>> >
>> > I'll have a proper look at this in the morning, and I'll try it out
>> > for myself. Looking forward to seeing more development on this.
>> >
>> > Michael
>> >
>> > On Thu, Mar 22, 2012 at 11:40 AM, Joseph Moniz 
>> > wrote:
>> >> Hey,
>> >>
>> >> So i had my first Hackathon at work last week and my project was to
>> >> prototype making a node.js clone using PHP instead of V8. So i
>> >> snatched up libuv and joyent's HTTP parser and set off on a 24 hour
>> >> coding spree to get something workable. By the time the sun was coming
>> >> out the next morning the following code was working.
>> >>
>> >>    > >>
>> >>    $http = new node_http();
>> >>
>> >>    $http->listen(8080, function($request, $response) {
>> >>        $response->end("yay, super awesome response");
>> >>    });
>> >>
>> >>    nodephp_run();
>> >>
>> >>    ?>
>> >>
>> >> The C code that powers it was whipped together really fast and is kind
>> >> of hackish as a result. The code has some memory leaks that i haven't
>> >> had time to fully track down yet. Some small portions of the code were
>> >> borrowed from the phode project.
>> >>
>> >> In a naive benchmark on this simple server VS an equally simple server
>> >> in node.js this implementation already out performs node.js in
>> >> throughput by being able to serve just under 200% the amount of
>> >> requests per second that node.js could. Take that with a grain of salt
>> >> though because node.js has much more feature and is much more hardend
>> >> from production use. I do believe the PHP binary will have some major
>> >> performance gains over V8 as crossing the PHP <--> C barrier seems to
>> >> be a much lighter operation then crossing the V8 <--> C++ barrier.
>> >>
>> >> Any help or feedback will be greatly appreciated. The projects source
>> >> code can be found here: https://github.com/JosephMoniz/node.php
>> >>
>> >> - Joseph Moniz
>> >>
>> >> --
>> >> PHP General Mailing List (http://www.php.net/)
>> >> To unsubscribe, visit: http://www.php.net/unsub.php
>> >>
>> >
>> > --
>> > PHP General Mailing List (http://www.php.net/)
>> > To unsubscribe, visit: http://www.php.net/unsub.php
>> >
>> >
>>
>> --
>> PHP General Mailing List (http://www.php.net/)
>> To unsubscribe, visit: http://www.php.net/unsub.php
>>
>

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Node.PHP

2012-03-22 Thread Michael Save
Very nice!

I'll have a proper look at this in the morning, and I'll try it out
for myself. Looking forward to seeing more development on this.

Michael

On Thu, Mar 22, 2012 at 11:40 AM, Joseph Moniz  wrote:
> Hey,
>
> So i had my first Hackathon at work last week and my project was to
> prototype making a node.js clone using PHP instead of V8. So i
> snatched up libuv and joyent's HTTP parser and set off on a 24 hour
> coding spree to get something workable. By the time the sun was coming
> out the next morning the following code was working.
>
>    
>    $http = new node_http();
>
>    $http->listen(8080, function($request, $response) {
>        $response->end("yay, super awesome response");
>    });
>
>    nodephp_run();
>
>    ?>
>
> The C code that powers it was whipped together really fast and is kind
> of hackish as a result. The code has some memory leaks that i haven't
> had time to fully track down yet. Some small portions of the code were
> borrowed from the phode project.
>
> In a naive benchmark on this simple server VS an equally simple server
> in node.js this implementation already out performs node.js in
> throughput by being able to serve just under 200% the amount of
> requests per second that node.js could. Take that with a grain of salt
> though because node.js has much more feature and is much more hardend
> from production use. I do believe the PHP binary will have some major
> performance gains over V8 as crossing the PHP <--> C barrier seems to
> be a much lighter operation then crossing the V8 <--> C++ barrier.
>
> Any help or feedback will be greatly appreciated. The projects source
> code can be found here: https://github.com/JosephMoniz/node.php
>
> - Joseph Moniz
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] hello everybody

2012-03-21 Thread Michael Save
w3schools is not a good source.

http://w3fools.com/

On Thu, Mar 22, 2012 at 5:33 PM, Midhun Girish  wrote:
> I think this would be an ideal resource for beginners
> http://www.w3schools.com/php/php_forms.asp. I used it when i began php. I
> would suggest doing the entire course in there. Really helpful.
>
> Regards
> Midhun Girish
>
>
>
> On Sun, Mar 18, 2012 at 10:05 PM, Jeremy Wei wrote:
>
>> you can read the content about form dealing in php manual:
>> http://us.php.net/manual/en/tutorial.forms.php
>>
>> On Sun, Mar 18, 2012 at 7:34 PM, saeed ahmed 
>> wrote:
>> > i am a full time warehouse worker and do not have time.i hardly can spend
>> > 2/3 hours a week on internet(at work we do not use internet but only
>> > computer)i am learning php and have xampp installed on my computer and i
>> > think i am learning slowly slowly.i want ot ask one favor to someone,who
>> is
>> > capable of doing this small work.i have learned that when visitor fill a
>> > form after visitor get message with his name.how this function is added
>> and
>> > where?
>> >
>> > can anyon give me a example like giving a example to a child of 10
>> years.i
>> > would like if someone explain me.
>>
>>
>>
>> --
>> JeremyWei(魏志锋,字静之)
>> Mob: 18914495716
>> 新浪微博:@JeremyWei
>> QQ: 327493482
>> Home: www.weizhifeng.net
>> Less is more
>>
>> --
>> PHP General Mailing List (http://www.php.net/)
>> To unsubscribe, visit: http://www.php.net/unsub.php
>>
>>

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] $POST and $_SESSION

2012-03-15 Thread Michael Save
How about this?

$first_name = @$_POST['first_name'] or $first_name =
$_SESSION['first_name'] ? $_SESSION['first_name'] : null;

Thanks,
Michael

On Fri, Mar 16, 2012 at 2:13 AM, Daniel Brown  wrote:
> On Thu, Mar 15, 2012 at 11:04, Tedd Sperling  wrote:
>> Hi gang:
>>
>> What's a better/shorter way to write this?
>>
>> $first_name = $_SESSION['first_name'] ? $_SESSION['first_name'] : null;
>> $first_name = isset($_POST['first_name']) ? $_POST['first_name'] : 
>> $first_name;
>> $_SESSION['first_name'] = $first_name;
>
>    A simple reusable function and pass-through variable is one method:
>
> 
>    session_start();
>    $_SESSION['first_name'] = $first_name =
> thisorthat(@$_POST['first_name'],null);
>
>    function thisorthat($a,$b) {
>        return isset($a) ? $a : $b;
>    }
>
> ?>
> --
> 
> Network Infrastructure Manager
> http://www.php.net/
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] questions about $_SERVER

2012-02-12 Thread Michael Save
On Mon, Feb 13, 2012 at 5:28 PM, Rui Hu  wrote:
> hi,
>
> How PHP sets variables in $_SERVER, say, $DOCUMENT_ROOT? What should I know
> if I want to modify $_SERVER myself?
>
> Thanks!
>
>
> --
> Best regards,
>
> Rui Hu
> 
> State Key Laboratory of Networking & Switching Technology
> Beijing University of Posts and Telecommunications(BUPT)
> MSN: tchrb...@gmail.com
> -

Rui,

$_SERVER is an associative array. You can access "DOCUMENT_ROOT" with
$_SERVER['DOCUMENT_ROOT']. It contains the document root directory
under which the current script is executing.

You can make changes to the $_SERVER array but it will have no effect
on PHP itself. I mean, you can change the value of
$_SERVER['DOCUMENT_ROOT'] to whatever you want at runtime, but of
course it will not actually change the current directory if that's
what you're after.

Thanks,
Michael

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php