newphpcoder Posted March 18, 2013 Share Posted March 18, 2013 HiGood day!I just want to know if what syntax/code should I use to put - in my data variable.for example I have this data.$lot_number_indi_scan = 'LO130315002LO130318001';I want to create a new variable and the output has added - between the lot_number_indi_scan like this:$newlot = 'LO130315002-LO130318001';I want to happen is first I will check the length of $lot_number_indi_scan if length is greater than 10 every lot_number_indi_scan has -like this: $newlot = 'LO130315002-LO130318001';Any help is highly appreciated.Thank you so much. Link to comment Share on other sites More sharing options...
Nico Posted March 18, 2013 Share Posted March 18, 2013 (edited) $newlot = implode('-', str_split($lot_number_indi_scan, 11)); ... assuming that the length of these codes is always eleven. Edited March 18, 2013 by Nico Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now