Re: PHP 4.0 Bug #5652:
| From: | Stanislav Malyshev | Date: | Tue, 18 Jul 2000 11:25:23 +0000 |
| Subject: | Re: PHP 4.0 Bug #5652: | ||
| References: | 1 | Groups: | php.dev |
| Request: | Send a blank email to php-dev+get-24885@lists.php.net to get a copy of this message | ||
>> $WhoIsServer="whois.nic.as";
>> $fp = fsockopen ("$WhoIsServer", 43, $errnr, $errstr);
>> set_socket_blocking($fp,0);
>> fputs($fp, "$domain\n"); // Open a connect
>> while (!feof($fp)) {
>> $result = fgets($fp, 2048);
>> $test = ereg_replace(10, " ", $result); // I've tried both
>> ereg_replace(), stripslashes(), stripcslashes() and str_replace() (only ereg_replace and str_replace
>> has worked the way I want)
>> print substr("$result",0,4);
>> if (substr("$test" ,12,8) == "Server") { //Hvis ledig
>> echo "$MsgFree";
>> }
>> else if (substr("$test" ,0, 6) == "Rights") { // Hvis opptatt
>> printf ("$MsgTaken");
>> }
>> }
>> fclose($fp); // Close
>> }
>>
>> ?>
>>
>> When I output the str_replaced string with print, printf and echo,
>> it is all on one line without newlines (I've tried both with \n and
>> ASCII character 10 to represent the newline). But when I use
>> substr($test, 0,12) fx. then it output the twelveth first characters
>> in every line in the original string ($result). When I use
>> substr($test, 2,4), it outputs the 2nd to 4th character in every
>> line in the original $result instead of printing the 2nd to 4th
>> character in the new string that shouldn't contain any newlines.
Well, I fail to understand what's the problem here. Does anybody?
--
Stanislav Malyshev stas@zend.com
+972-3-6139665