www.webdeveloper.com
Results 1 to 1 of 1

Thread: [RESOLVED] Lambda Functions and @

  1. #1
    Join Date
    Dec 2005
    Posts
    2,984

    resolved [RESOLVED] Lambda Functions and @

    I am doing a sort of e-mail validation via AJAX and I used a lambda function like this:

    PHP Code:
    create_function('','global $ajaxUserObj; $ajaxUserObj->checkEmail('.$_GET['email'].');'); 
    I am doing it onKeyUp in the email field so it works for all of the following:

    e
    em
    ema
    emai
    email

    but as soon as I get to:

    email@

    it breaks with this error:

    Code:
    <b>Parse error</b>:  syntax error, unexpected '@' in <b>/home/swaag701/public_html/wp-content/plugins/ajax-users/ajax-users.php(262) : runtime-created function</b> on line <b>1</b><br />
    I'm stumped....anybody know why it can't handle the @?


    EDIT: Problem solved. I don't know why I thought I needed to put the $_GET['email'] "outside" of the PHP string that was to be executed. The proper way to write the lambda function was like this:

    Code:
    create_function('','global $ajaxUserObj; $ajaxUserObj->checkEmail($_GET["email"]);');
    Last edited by aj_nsc; 09-03-2011 at 09:35 AM.
    I've switched careers...
    I'm NO LONGER a scientist,
    but now a web developer...
    awesome.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles