rtrim array code example Example: php rtrim $colors=trim("blue,red,green,",",");//remove last , with rtrim