<?php $string = ',1,2,,4,5,,,,6,,,,'; echo preg_replace('/,\K,+/', '', trim($string, ','));
You have javascript disabled. You will not be able to edit any code.