Jump to content

double parentheses


samsplug

Recommended Posts

below is an extract of code which i have copied from a book which i have been studying...

The code is a segment from a script about paginating query results. I understand almost all of the below code except the ... (($display * ($i – 1)))  ... Why is a double parentheses used around the $display variable.

 

For ($i = 1; $i <= $pages; $i++) {
if ($i != $current_page) {
	echo ‘< a href=”view_users.php?s=’ . (($display * ($i – 1))) . ‘&p=’ . 
                $pages . ‘”>’ . $i . ‘</a> ‘;
} else {
	echo $i . ‘ ‘;
}
}

 

I'd be really grateful if someone could explain that to me :)

thanks

Link to comment
Share on other sites

There is no reason for it.

 

You can remove the parentheses and it will function just the same. Just don't remove the ones from around $i-1.

 

I guess its the author's personal coding style preference. Possibly to make it easier to read.

Thats weird... They have no purpose at all??

Thanks for the quick reply :)

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.