The sprintf
function grabs the first argument as a string and as Fosco already explained - the %s
's are basically placeholders (%s are for strings, there are other abbrevations as well, but lets not get into that right now). All but the first argument of the sprintf
function acts like the replacement content for the placeholders. The first argument (skipping the actual first, the string, making it the second argument if you will) replaces the first placeholder with the proper content, the second (actual 3rd) argument would replace the second placeholder and so on.
The % characters within the second and third arguments acts like a any character
character in a SQL query. Basically what it does is that it allows the search term to be between any characters. If the second argument would of have looked like '%'.$search_term
it would only allow characters in front of the search term, but not behind.
Fosco also explained the usage of LIMIT
pretty well I suppose, thus me not getting deeper into that specific area.