Hello everyone, I'm newbie and I need some helpful for my problem:

class pages {
    var $total_pages = NULL;
    var $scroll_pages = NULL;
    ...
    function page_link (...) {
        if ($this -> total_pages <= $this -> scroll_pages)  {
        ...
        }
    }
}

Sorry I don't understand the code above and It's very long, so I don't write full code. But my problem is focus on this line:

if ($this -> total_pages <= $this -> scroll_pages)  {

I don't understand the meaning of this line, can everybody help me ???
Thank in advandce to everybody.

you will learn how to make a website with PHP, html, css, JS, html5 at w3schools!

commented: Your reply is not helpful at all -1

<= in this case means less than or equal to or in your example:

if the value of attribute $this->total_pages is less than or equal to a value of attribute $this->scroll_pages, then ...

See http://php.net/manual/en/language.operators.comparison.php

Attributes are variables of classes/objects, similar to properties in some other OOP languages. The -> is OOP operator to access properties and methods of an object (similar to a . in other OOP languages).

it means

$this

less than or equal to

total_pages

@nguoixanh,

Don't be confused with it. It is just a comparison operator. What the thing meant is that IF total_pages is LESS THAN or EQUAL to scroll_pages, THEN do something.

What you should have paid attention closely, is on how the script come up with this..
$this->$total_pages and $this -> scroll_pages, because that's the one that will prime yourself in OOP.

Something like this..
$this -> scroll_pages = $scroll_pages;
$this -> total_pages = $total_pages;


Without using the class pages, you can also practice using those operators by just practicing in something simple like..

<?php
$scroll_pages = 5;
$total_pages = 10;

## let's practice something similar to the page class above.
## normally in class you would start as $whatever = new page(); $whatever->page_link();, and the function page_link will get executed or evaluated..

if($total_pages <= $scroll_pages){

echo "Total pages is less than or equal to Scroll pages";
}

else{

## if you run this script, it should print Total pages is greater than Scroll pages on your screen

echo "Total pages is greater than Scroll pages";

}
?>

<= pacman is eating 2 cookies?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.