2

This is not a request for a solution, but just to clarify something.

When I do a redirect in php I use header()

but while going through someone else's class code I came across this:

 // Redirect to target
 redirect(proxifyURL($url, 'norefer'));

What the heck is that? And php does not seem to be throwing an error.

I tried looking it up by going to php.net/redirect but it shows me the header function that I usually use, not this redirect() !!??

Can someone explain this to me please?

3
  • 1
    have you looked through the whole source code? that looks like an own function. Commented Jul 17, 2011 at 15:24
  • use your ide to search for "redirect" occurences in that project folder Commented Jul 17, 2011 at 15:25
  • Yep, found it in one of the included files, thanks guys! Commented Jul 17, 2011 at 15:29

2 Answers 2

9

It's probably a user-defined function. This means that the function isn't present in standard PHP, but that the author of the code you read made it himself.

Sign up to request clarification or add additional context in comments.

1 Comment

Ah yes, I found it in one of the included files! Thanks for your help guys!
4

He probably defined a new function that looks something like this

function redirect($to)
{
    header("Location: $to");
    die();
}

6 Comments

you can't know if that function uses header or maybe just put a meta tag redirect in the html
it doesn't matteR! I'm just showing example how can be redirect() function declared ...
i guess he know how a function is declared
@genesis: Say so then (i.e. "He probably defined a new function that looks something like this", not "He did X" as if you knew exactly how the function was defined)
|

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.