I have a function in Java which I need to convert into php. It converts unicode text into characters. For example input is
"Every person haveue280 sumue340 ambition";
I want to replace ue280, ue340 to \ue280, \ue340 with regular expression
Here is code written in Java
String in = "Every person haveue280 sumue340 ambition";
Pattern p = Pattern.compile("u(\\p{XDigit}{4})");
Matcher m = p.matcher(in);
StringBuffer buf = new StringBuffer();
while(m.find())
m.appendReplacement(buf, "" + (char) Integer.parseInt(m.group(1), 16));
m.appendTail(buf);
String out = buf.toString();
Is it possible to convert it into php
Thanks in advance