this should be very simple question, but i cant get it working for some reason, my framework is PHALCON
$string='GuGuSy';
i want this to be replaced as
$output = 'AAB';
so I coded it as:
public function graha($planet)
{
if(strpos($planet,'Sy')!==false){
$planet = preg_replace("/Sy/",'B',$planet);
}
if(strpos($planet,'Gu')!==false){
$planet = preg_replace("/Gu/",'A',$planet);
//str_replace("Gu",'A',$planet);
}
return $planet;
}
but output I get is not correct, why?
My output is for the string is "A" only why ?