Re: Re: socket gives notice on server side(simple newbie code)
| From: | Negin Nickparsa | Date: | Wed, 20 Aug 2014 19:02:11 +0000 |
| Subject: | Re: Re: socket gives notice on server side(simple newbie code) | ||
| References: | 1 2 3 4 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-323767@lists.php.net to get a copy of this message | ||
Sincerely
Negin Nickparsa
On Wed, Aug 20, 2014 at 8:09 AM, Jim Giner <jim.giner@albanyhandball.com>
wrote:
> On 8/20/2014 11:00 AM, Negin Nickparsa wrote:
>
>> echo "you entered ".$input;
>> if($stock[$input]!=NULL)
>> {
>> $answer=$stock[$input];
>> socket_write($sock,$answer, $port);
>>
>> }
>> else{
>> echo socket_strerror(0);
>> }
>>
>
> How about adding the following before the above lines:
> if (!isset($stock[$input]))
> print_r($stock);
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
> Jim you were right it wasn't set the output is as follow:
c:\wamp\www\phpzend>php -f server.php
you entered salam
Array
(
[salam] => salam
[esmet chie] => negin
[chika mikoni] => socket minevisam!
)
Notice: Undefined index: salam
in C:\wamp\www\phpzend\server.php on line 14
Call Stack:
0.0010 232832 1. {main}() C:\wamp\www\phpzend\server.php:0
The operation completed successfully.
Also Robert I did trim it as you said and the result didn't change
so what's the problem why it is not set! there?!