Jump to content

chr() concerning an ereg_replace() use of function enquiry


j.smith1981

Recommended Posts

I am interested in just this little snippet of code I am writing for a basic TCP socket server in PHP.

 

Just basically goes along the lines of this:

<?php
$value = ereg_replace("\n\t\r", "", trim($input)).chr();

 

It's actually regarding the chr() I know actually its nothing to do with the regular expression replace but what does it actually mean to PHP?

 

I mean I am just using it as an output from a socket_read (as that's what $input is assigned to the value of), but what does the char(0) mean?

 

I mean I seem to remember it being knowing the end of a line of data once the clients sent data into the stream PHP looks at chr(0) as the end of the line of data is that the right way of thinking about this logically?

 

Any helps appreciated, trying to explain such a topic on my blog and I am confused about what to say about that one little bit, I know it's not really part of the regular expression but what does it actually do?

 

Again massive thanks in advance for any replies,

Jeremy.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.