ohdang888 Posted February 15, 2010 Share Posted February 15, 2010 ok so i want to take this (stored in a variable): 2010,02,15,23,59,59 and make it this: 2010,01,15,23,59,59 in other words, i want to take the value between the 1st and 2nd comma, and subtract it by 1. How would i go about doing this? Thanks Quote Link to comment https://forums.phpfreaks.com/topic/192167-between-1st-and-2nd-comma-substract-how/ Share on other sites More sharing options...
jl5501 Posted February 15, 2010 Share Posted February 15, 2010 $var1 = '2010,02,15,23,59,59'; $var1_arr = explode(",",$var1); $var1_arr[1] = (int) $var1_arr[1] - 1; $var1 = implode(",",$var1_arr); Quote Link to comment https://forums.phpfreaks.com/topic/192167-between-1st-and-2nd-comma-substract-how/#findComment-1012745 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.