Decypher line of code

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • amolbehl
    New Member
    • May 2007
    • 63

    Decypher line of code

    print redirect(sprint f("$url?$query_ string", uri_escape($use r_query)));

    what does the statement above do??

    I am particularly interested in the sprintf part.
  • miller
    Recognized Expert Top Contributor
    • Oct 2006
    • 1086

    #2
    Without knowing anything about the variables used in this statement, I would conclude that the line is a bug containing legacy code references.

    If you want to know about sprintf just read about it at perldoc.

    perldoc sprintf

    - Miller

    Comment

    • amolbehl
      New Member
      • May 2007
      • 63

      #3
      sprintf("$url?$ query_string", uri_escape($use r_query))

      here the url has some valid url and query strings are the get args to be passed but where does the $userquery fit in this I mean there is no %s or %d which will get the value of $userquery.

      Comment

      • KevinADC
        Recognized Expert Specialist
        • Jan 2007
        • 4092

        #4
        print redirect(sprint f("$url?$query_ string", uri_escape($use r_query)));

        what does the statement above do??
        It appears to needlessly use sprintf.

        Comment

        • miller
          Recognized Expert Top Contributor
          • Oct 2006
          • 1086

          #5
          Originally posted by amolbehl
          sprintf("$url?$ query_string", uri_escape($use r_query))

          here the url has some valid url and query strings are the get args to be passed but where does the $userquery fit in this I mean there is no %s or %d which will get the value of $userquery.
          If the $url or $query_string contain the %s or %d, then the sprintf will do somethign with the $user_query. But once again, without knowing what those variables contain, there's no way to know for sure.

          My guess is that it's simply legacy code and the use of sprintf is no longer needed like Kevin suggested.

          - Miller

          Comment

          Working...