Page 1 of 1

A percent sign in front a variable...what is that mean?

Posted: Thu Sep 08, 2011 4:59 pm
by tangcsg
Hi, I'm a beginner to php coding. Recently I came across a function tag next_post_link, having a format parameter takes value of variable %link. I just don't understand why it's not $link since that's the standard way of naming a php variable. Perhaps there is other meaning of % when it is used in this case. Can anybody tell me what's the difference between % and $ when they are used in front of a php variable?

<?php next_post_link('%link', 'Next post in category', TRUE, '13'); ?>

Re: A percent sign in front a variable...what is that mean?

Posted: Thu Sep 08, 2011 5:20 pm
by twinedev
That isn't a variable, it is a string being passed as the parameter (it is wrapped with quotes). You would need to look at the code for the function to see what it does with it.

-Greg

PS: Here is explanation on what it is for WP: http://codex.wordpress.org/Function_Ref ... _post_link