Converting to PHP

Expert please help me…

I goggling just came out with simple explanation and no answer at all.

Here I have JavaScript code and I wish to convert it into PHP style…

var Vble = '5';
var Hg = Vble.charCodeAt(0)^2;
var writeIn = String.fromCharCode(Hg);
document.write(writeIn);

when execute, the result = 7. I try convert it into PHP using ord() and chr() but the output not the same…why? Suggestion please…!! thanks