Code Snippets

  

PHP Source Code


Welcome to Dream.In.Code
Become a PHP Expert!

Join 137,222 PHP Programmers for FREE! Get instant access to thousands of PHP experts, tutorials, code snippets, and more! There are 2,116 people online right now. Registration is fast and FREE... Join Now!





PHP left() and right()

PHPs version of the ASP functions left() and right()

Submitted By: pemcconnell
Actions:
Rating:
Views: 618

Language: PHP

Last Modified: August 8, 2008
Instructions: Add functions to top of code, then call them using the following syntax:


Snippet


  1. <?php
  2.  
  3. function right($value, $count){
  4.     $value = substr($value, (strlen($value) - $count), strlen($value));
  5.     return $value;
  6. }
  7.  
  8. function left($string, $count){
  9.     return substr($string, 0, $count);
  10. }
  11.  
  12. ?>

Copy & Paste


Comments


There are currently no comments for this snippet. Be the first to comment!

Add comment


You must be registered and logged on to </dream.in.code> to leave comments.





Live PHP Help!

PHP Tutorials

Reference Sheets

PHP Snippets

DIC Chatroom

Bye Bye Ads

Monthly Drawing

Thumb Drive

Top Contributors

Top 10 Kudos This Month