<?php

error_reporting(-1);

$regexp = '!^(htt(p|ps):\/\/[\S]{3,})|(^$)!';

$correctNumber = array(
    'http://w...content-available-to-author-only...x.runkit_import(filename)',
    'https://1232145',
    'http://e...content-available-to-author-only...e.com',
    'https://2...content-available-to-author-only...h.hk/pr/res/461342.html#465723',
    ''
);

$wrongNumber = array(
    'http://example com with     many spaces',	
    ' https://2...content-available-to-author-only...h.hk/pr/res/461342.html#465723',
    'http, http://, example.com',
    'http://ex',
    'http://',
    'l',
    ' http:// ',
    'https:// ',
    'https://',
    ' ',
    '  ',
    '  ',
    '   ',
    '    ',
    '     ',
    '      ',
    '       ',
    '          ',
    '            ',
    '      sdfsdf      ',
    'sdfsdf      sdfsdf      ',
    'qeqweqw',
    '            ',
);

echo "Верные номера.\n\n";

for ($i = 0; $i < count($correctNumber); $i++) {
    if (preg_match($regexp, $correctNumber[$i])) {
        echo "[+] Номер \"{$correctNumber[$i]}\" записан верно.\n";
    } else {
        echo "[-] Номер \"{$correctNumber[$i]}\" записан не верно.\n";
    }
}

echo "\nНеверные номера.\n\n";

for ($i = 0; $i < count($wrongNumber); $i++) {
    if (preg_match($regexp, $wrongNumber[$i])) {
        echo "[+] Номер \"{$wrongNumber[$i]}\" записан верно.\n";
    } else {
        echo "[-] Номер \"{$wrongNumber[$i]}\" записан не верно.\n";
    }
}
