note 104821 modified in control-structures.switch by danbrown

From: Date: Sat, 09 Jul 2011 16:23:00 +0000
Subject: note 104821 modified in control-structures.switch by danbrown
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-181379@lists.php.net to get a copy of this message
Quotable Cases <?php while (false !== ($char = fgetc($fp))) { switch ($char) { case '<' : $response.='&lt;'; break; case '>' : $response.='&gt;'; break; //case "\r" : // NOTE that the \r and \n WILL // match when enclosed within // double quotes, but WILL NOT // MATCH when enclosed within // single quotes. The < and > will // match when enclosed within // single quotes. case "\n" : $response.='<br />'; break; default : $response.=$char; } // switch } // while echo $response; ?> --was-- Quotable Cases [code] while (false !== ($char = fgetc($fp))) { switch ($char) { case '<' : $response.='&lt;'; break; case '>' : $response.='&gt;'; break; //case "\r" : // NOTE that the \r and \n WILL // match when enclosed within // double quotes, but WILL NOT // MATCH when enclosed within // single quotes. The < and > will // match when enclosed within // single quotes. case "\n" : $response.='<br />'; break; default : $response.=$char; } // switch } // while echo $response; [/code] http://php.net/manual/en/control-structures.switch.php

« previous php.notes (#181379) next »