Home
Forums
Programming
Web Development
Tutorials
Snippets
Blogs
Freelance
Jobs
Lounge
Login
Join for Free!
Programming Help
C and C++
Visual Basic
Java
VB.NET
C#
ASP.NET
PHP
ColdFusion
Perl and Python
Ruby
Databases
Other Languages
Game Programming
Software Development
Computer Science
Industry News
Web Development
Web Development
HTML & CSS
JavaScript
Graphic Design
Flash & ActionScript
Blogging
SEO & Advertising
Web Servers & Hosting
Site Check
What's Here?
Members:
137,222
Replies:
481,478
Topics:
75,057
Snippets:
2,567
Tutorials:
675
Total Online:
2,116
Members:
99
Guests:
2,017
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!
Chat
LIVE
With a PHP Expert
PHP left() and right()
PHPs version of the ASP functions left() and right()
Submitted By:
pemcconnell
Actions:
Rating:
0
1
2
3
4
5
Views:
618
Language:
PHP
Last Modified:
August 8, 2008
Instructions:
Add functions to top of code, then call them using the following syntax:
Snippet
<?php
function
right
(
$value
,
$count
)
{
$value
=
substr
(
$value
,
(
strlen
(
$value
)
-
$count
)
,
strlen
(
$value
)
)
;
return
$value
;
}
function
left
(
$string
,
$count
)
{
return
substr
(
$string
,
0
,
$count
)
;
}
?>
Copy & Paste
<?php function right($value, $count){ $value = substr($value, (strlen($value) - $count), strlen($value)); return $value; } function left($string, $count){ return substr($string, 0, $count); } ?>
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.
Advertising
|
Terms of Use
|
Privacy Policy
|
About Us
|
Site Map
Forum Index:
Programming Help
|
C and C++
|
Visual Basic
|
Java
|
VB.NET
|
C#
|
ASP.NET
|
PHP
|
ColdFusion
|
Perl and Python
|
Ruby
|
Databases
|
Other Languages
|
Game Programming
|
Software Development
|
Computer Science
|
Industry News
|
Programming Tutorials
|
C++ Tutorials
|
Visual Basic Tutorials
|
Java Tutorials
|
VB.NET Tutorials
|
C# Tutorials
|
PHP Tutorials
|
Linux Tutorials
|
ColdFusion Tutorials
|
Windows Tutorials
|
HTML/JavaScript Tutorials
|
CSS Tutorials
|
Flash Tutorials
|
Web Promotion Tutorials
|
Photoshop Tutorials
|
Software Development Tutorials
|
Database Tutorials
|
Other Language Tutorials
|
Copyright 2001-2008
MediaGroup1 LLC
, All Rights Reserved
A
MediaGroup1 LLC
Production - Version 6.0.2.1.36
Search
Updated!
w00t
Over 509,000 Pages!
Advanced Forum Search
Live PHP Help!
PHP Tutorials
Working With Excel Files. (comma Delimited Or Csv)
Textarea Editor
Working With Excel Files. (tab-delimited)
PHP Quick Reference (Cheat) Sheet
Send Emails Using Php (basic)
Dynamic Web Site
mySQL & PHP: A Beginners Look
Calculating age tutorial
Upload A File From A Form
Practical PHP Coding Standards
66 More PHP Tutorials...
Reference Sheets
PHP Snippets
Full url of the page
IP Logger
online file editor
Reading text files
Checkbox list storing
Page Generation
Pear Mail_Queue interface
Convert a 64 bit number
Generating image with random number (anti-bot)
Years, Days, Hours, Minutes Ago
164 More PHP Snippets...
DIC Chatroom
Join our IRC Chat
Bye Bye Ads
Monthly Drawing
Top Contributors
Top 10 Kudos This Month
LifeHacker
(50)
sharpy
(50)
KYA
(50)