0
Ähnlich wie die How to find the missing next character in the array?. Ich muss das Gleiche in PHP implementieren. Ich habe dies in JavaScript jetzt:Finden Sie das fehlende nächste Zeichen im Array
function findMissingLetter (ar) {
for (var i = 1; i < ar.length; i++) {
if (ar[i].charCodeAt(0) != ar[i-1].charCodeAt(0)+1) {
return String.fromCharCode(ar[i-1].charCodeAt(0)+1);
}
}
return true;
}
var a = ['a','b','c','d','f']
var b = ['O','Q','R','S']
console.log(findMissingLetter(a));
console.log(findMissingLetter(b));
ich dies in PHP konvertieren möchten.