<?php

$string = 'hi ϕllip       it is 900°';

$output = preg_replace(array('/( )+/', '/\x{00B0}/u', '/\x{03A6}/u', '/\x{03D5}/u'), array(' ','&deg;','&Phi;','&Phi;'), $string );


    echo "this is the output:"  . $output;