hyster Posted March 12, 2011 Share Posted March 12, 2011 i have a set of array's with a similer layout as t127201103111200 what i need to do is split it like this t:1:27:2011:03:11:1200 (where the : is where i want the split but not add the : ). so i end up with this. $a = t $b = 1 $c = 27 $d = 2011 $e = 03 $f = 11 $g = 1200 what i think i need to do is split(char1($a), char2($b), char3,4($c)...........................) but have no idea where to start. Thanks for any help Link to comment https://forums.phpfreaks.com/topic/230414-split-an-array/ Share on other sites More sharing options...
PFMaBiSmAd Posted March 12, 2011 Share Posted March 12, 2011 Are all the lengths of the fields exactly as shown or could say the leading 1 ever be two digits? Link to comment https://forums.phpfreaks.com/topic/230414-split-an-array/#findComment-1186587 Share on other sites More sharing options...
hyster Posted March 12, 2011 Author Share Posted March 12, 2011 thanks. i didnt think about the auto increment t127201103111200 $a = t = not changable $b = 1 = changable. auto incrament $c = 27 = changable. auto incrament $d = 2011 = not changable. year $e = 03 = not changable. day $f = 11 = not changable . month $g = 1200 = not changable. time Link to comment https://forums.phpfreaks.com/topic/230414-split-an-array/#findComment-1186590 Share on other sites More sharing options...
PFMaBiSmAd Posted March 12, 2011 Share Posted March 12, 2011 Unless you have specific rules about the field lengths or the specific range of values for the fields, you won't be able to determine the $b and $c values. For your example, how do you know that $b shouldn't be 12 and $c shouldn't be 7? Link to comment https://forums.phpfreaks.com/topic/230414-split-an-array/#findComment-1186592 Share on other sites More sharing options...
hyster Posted March 12, 2011 Author Share Posted March 12, 2011 ok. thanks for your help. Link to comment https://forums.phpfreaks.com/topic/230414-split-an-array/#findComment-1186593 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.