Re: Re: socket gives notice on server side(simple newbie code)

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Sincerely
Negin Nickparsa


On Wed, Aug 20, 2014 at 9:05 AM, Robert Williams <rewilliams@xxxxxxxxxx>
wrote:

> I suspect there's a line-feed character in the input value. Try changing
> this:
>
>    if($stock[$input]!=NULL)
>
> to this:
>
>    if($stock[trim($input)]!=NULL)
>
> --
> Robert E. Williams, Jr.
> Senior Vice President of Software Development
> Newtek Businesss Services, Inc. -- The Small Business Authority
> https://www.newtekreferrals.com/rewjr
> http://www.thesba.com/
>
>
>
​Robert actually you were right! var_dump had the string(7) "salam" so it
is not string(4) and that is the problem the problem was somewhere else
which I didn't get it at first
thank you guys! great help!

I learned that I should trim my string even when it is string with STDIN it
would include the quotes in the string too​



> On Aug 20, 2014, at 08:09, Jim Giner <jim.giner@xxxxxxxxxxxxxxxxxx> 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
> >
>
>
> Notice: This communication, including attachments, may contain information
> that is confidential. It constitutes non-public information intended to be
> conveyed only to the designated recipient(s). If the reader or recipient of
> this communication is not the intended recipient, an employee or agent of
> the intended recipient who is responsible for delivering it to the intended
> recipient, or if you believe that you have received this communication in
> error, please notify the sender immediately by return e-mail and promptly
> delete this e-mail, including attachments without reading or saving them in
> any manner. The unauthorized use, dissemination, distribution, or
> reproduction of this e-mail, including attachments, is prohibited and may
> be unlawful. If you have received this email in error, please notify us
> immediately by e-mail or telephone and delete the e-mail and the
> attachments (if any).
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux