$ Out & quot; and then $ out. what is the difference between it and $ out? the following example shows PHPcode $ fp @ fsockopen ($ whoisserver, $ port, $ errno, $ errstr, $ timeout) ordie (& quot; socketError & quot ;. $ errno. & quot; $ out = "" and then $ out. = What is the difference from direct $ out =? The following is an example.
PHP code
$fp = @fsockopen($whoisserver, $port, $errno, $errstr, $timeout) or die("Socket Error " . $errno . " - " . $errstr); fputs($fp, $domain . "\r\n"); $out = ""; while (!feof($fp)){$out .= fgets($fp);} fclose($fp);
Ask here
PHP code
$out = ""; while (!feof($fp)){$out .= fgets($fp);}
Yu and
PHP code
while (!feof($fp)){$out= fgets($fp);}
What is the difference?
------ Solution --------------------
The initialization operation. if the $ out type is not initialized, it is null. it is different from the string type you want. you can check it with var_dump.
If $ out is used for condition determination, unexpected results may be obtained without initialization.
------ Solution --------------------
$ Out = "";
While (! Feof ($ fp) {$ out. = fgets ($ fp );}
All content in the $ fp file can be obtained.
$ Out = "";
While (! Feof ($ fp) {$ out = fgets ($ fp );}
The last line of the $ fp file is obtained.