Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on Aug 10th, 2012  |  syntax: None  |  size: 0.34 KB  |  hits: 12  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. PHP: Skipping to a position given by strpos()
  2. $string[$index]
  3.        
  4. <?php
  5. $rest = substr("abcdef", 0, -1);  // returns "abcde"
  6. $rest = substr("abcdef", 2, -1);  // returns "cde"
  7. $rest = substr("abcdef", 4, -4);  // returns false
  8. $rest = substr("abcdef", -3, -1); // returns "de"
  9. ?>
  10.        
  11. $new_string = substr( $string, strpos($string, 'a') );