Posted By

bodito on 01/06/11


Tagged

php substr substring


Versions (?)

Who likes this?

1 person have marked this snippet as a favorite

bodito


PHP substr


 / Published in: PHP
 

URL: http://es.php.net/manual/es/function.substr.php

  1. <?php
  2. $rest = substr("abcdef", -1); // devuelve "f"
  3. $rest = substr("abcdef", -2); // devuelve "ef"
  4. $rest = substr("abcdef", -3, 1); // devuelve "d"
  5. $rest = substr("abcdef", 0, -1); // devuelve "abcde"
  6. $rest = substr("abcdef", 2, -1); // devuelve "cde"
  7. $rest = substr("abcdef", 4, -4); // devuelve false
  8. $rest = substr("abcdef", -3, -1); // devuelve "de"
  9. ?>

Report this snippet  

You need to login to post a comment.