- var_dump: documentation ( source)
- octdec: documentation ( source)
- decoct: documentation ( source)
<?php
function IsOcta($string){
(int) $x=octdec("$string"); // Input must be a String and octdec returns NUMBER
$y=decoct($x); // Must be a Number and decoct returns STRING
echo "<br />IsOcta() - Octal Number Reconverted: ".$y;
if($string==$y){
echo "<br /> Result: OCTAL";
}else{
echo "<br /> Result: NOT OCTAL";
}
}
$octal = 010;
var_dump(IsOcta($octal));