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

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
tangcsg
Forum Newbie
Posts: 2
Joined: Thu Sep 08, 2011 4:46 pm

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

Post 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'); ?>
User avatar
twinedev
Forum Regular
Posts: 984
Joined: Tue Sep 28, 2010 11:41 am
Location: Columbus, Ohio

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

Post 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
Post Reply