1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Creating/Using PHP Callback

Discussion in 'XenForo Development Discussions' started by ThyPhon, Apr 1, 2015.

  1. ThyPhon

    ThyPhon Member

    Hi everyone,
    I want to create a costum user field that must be include user's mobile phone number like +901234567890, but I'm not sure how to create/use php callback.

    May the below php code be help?


    function gsm($text) {
    $text  preg_replace("/[^0-9]/"""$text);
    $first substr("$text",0,1);
    $first == "0") { $text substr($text,1); }

    $ninety substr("$text",0,2);
    $ninety != "90") {
    $new_gsm "Invalid: Not TR's country code."; }
        else {
    $gsm substr($text,2);
    substr("$gsm",0,1) == "0") {
    $gsm substr($gsm,1); }

    strlen($gsm) != "10") {
    $new_gsm "Invalid: Must be in this format (901112223344)"; }
            else {
    $new_gsm "+$ninety$gsm"; }



Share This Page