<?php // your code goes here$str = "dubai,sharjah,";$data = implode("','",explode(',',rtrim($str,',')));echo "'$data'";
Standard input is empty
'dubai','sharjah'
The brand new service which powers Ideone!
Widget for compiling and running the source code in a web browser!