rfc:strncmpnegativelen

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
Next revisionBoth sides next revision
rfc:strncmpnegativelen [2011/08/14 14:41] laruencerfc:strncmpnegativelen [2011/08/14 15:02] – [Introduction] laruence
Line 22: Line 22:
 </code> </code>
  
-but we know substr supports a negative length as its parameter:+We need to write some codes like following one to make it works as expect
 <code php> <code php>
 <?php <?php
-   echo substr("test", 0, -1);+   if (strncmp(substr("prefix_num", -3, 3), "num", 3) === 0) { 
 +        echo "they have same suffix\n"; 
 +   } 
 +?> 
 </code> </code>
  
rfc/strncmpnegativelen.txt · Last modified: 2017/09/22 13:28 by 127.0.0.1