basic-problem / get-two-last-index-string.php

GEt Two Last Index String

<?php
function getTwoLastIndexString($str)
{
    $len = strlen($str);
    return substr($str, $len - 2, 2);
};


echo getTwoLastIndexString("Hello World"); // Output: ld

GEt Two Last Index String | basic-problem | Study Notes | Ferdyhape