Hi,

i have a massive problem, and i thought nah, itll be easy to fix, with a bit of mucking round, but i think i have come across a limitation in php (i could also be verrrrry wrong)

i think i have got to the point, where i have stopped remembering the small typos, and semicolons, and benn doing this too long to see them...

anyway, heres the question:

in my userdefined function it have a function (pregmatch), now i know every function returns a true or false bool ( so you can use them in if statements)
can pregmatch return true, AND THEN MY USERDEFINED FUNC return what ever preg match returned.

after looking a what i want to do, i think am going to add more lines to my code......

if you can understand that...

THANKS heaps

    Sounds simple to do...

    function myFancyWonderfulTalentedFunction($data) {
        return preg_match('/^chickengizzards_[0-9A-GK-Psm]{3,9}$', $data);
    }

      ahhhhhhhh

      so you have to add return BEFORE....

      ok, thanks, now whats the theory behinfd that...

      thanks heaps

        davo666 wrote:

        so you have to add return BEFORE....

        I'm confused... what were you doing instead? I mean, you don't have to return the function's output directly, you could do:

        function myFancyWonderfulTalentedFunction($data) { 
            $return = preg_match('/^chickengizzards_[0-9A-GK-Psm]{3,9}$', $data);
            return $return;
        } 

          no i was just being an idiot:

          function username_bad_char ($username){

          if statement? preg_match(regex(couldnt be stuffed typing, $username) {?

          return? true?

          }?
          }

          all the things with ?'s is what i tried, i kew i had to implement return, but i didnt know how...

          see?

            In other words, to return the result of calling a function you ... return the result of calling the function.

              Write a Reply...