Supported Versions: PHP 4, PHP 5, PHP 7, PHP 8
Find whether the type of a variable is string
<?php is_string(mixed $value): bool
<?php     public static function ifJsonToArray(mixed $data): string|object|array {

        if (is_string($data)) {

            $array = json_decode($data, true);

            $data = is_array($array) ? $array : $data;

        }
<?php     private static function evaluateOperation(string $a, string $operator, string $b): bool|int {

        $a = is_numeric($a) ? (int) $a : $a;

        $b = is_numeric($b) ? (int) $b : $b;

        $either_is_string = is_string($a) || is_string($b);

        $match = match ($operator) {

            '==' => $a == $b,

            '!==' => $a !== $b,