PHP会爆炸一个字符串但保持序列化部分不变

I am trying to take a string, which is actually part of a insert statement, explode it ( it is separated by commas ) and then test reform the string depending on the index of the value. I have everything done but realize that exploding by a comma while potentially having a serialized value with the whole string as its own value will actually explode that serialized value which throws the whole thing off. Im trying to avoid having to go back and check before creating the string, that would be very involved but might be my only option. I was wondering if there is a way to take the initial string and separate it by the commas without separating the actual serialized value within the string. An example is below.

 NULL,NULL,NULL,NULL,'hello world','a:3:{s:6:"johnny";a:3:{s:7:"physics";s:9:"great job";s:5:"maths";s:19:"you did a, good job";s:9:"chemistry";s:27:"need to work on this, johny";}s:5:"brady";a:3:{s:7:"physics";s:9:"great job";s:5:"maths";s:19:"you did a, good job";s:9:"chemistry";s:27:"need to work on this, brady";}s:5:"keith";a:3:{s:7:"physics";s:9:"great job";s:5:"maths";s:19:"you did a, good job";s:9:"chemistry";s:27:"need to work on this, keith";}}',NULL,23,14