phpeveryday.com

The best tutorial of php, php framework, php strategies, object oriented oriented,


String: Splitting Strings to Chunks

Tag: string, str_split, array   Category: PHP Basic
post: 03 Feb 2008 read: 284


PHP String tips: We have project (ex, property management system) that involve identity number of properties. This identity have structure format like this: [year of buying][category][subcategory][2 digit sequence alphabet][2 digits sequence number]. Example like this 080201AB38 (08=year of buying, 02=category: computer, 01= subcat: monitor, AB = sequence alphabet, 38=sequence number). Then we want to identify each of this number. We can use str_split.


$assetID = "080201AB38"; 

$arr1 = str_split($assetID,2);

result may like this:


Array 
( 
   [0] => 08 
   [1] => 02 
   [2] => 01 
   [3] => AB 
   [4] => 38 
) 



| Give Your Opinion | Recommend
Share and Bookmark to: These icons link to social bookmarking sites where readers can share and discover new web pages.
digg del.icio.us technorati Ma.gnolia BlinkList

Recommended articles by other readers:
Web Services: How PHP Kiss VB.NET? (Part 1)
Chart: How to Build Cool Animation Real Time Chart
Joomla: Fast Road to Understand Component Programming
Email: Send Attachement Mail
mod_rewrite - Part 1: create your "fantasy" URL

What do You Think?
Your Name *:
Email *:
(Will not be published)
Website/URL:
Your Comment *:
* Required


615
posting