Hello everybody, 

In this class sketch:


<?php

class Pagination {

    ...
      
        public static function Pagination ($total_records, $limit, $page)


        {

          $total_pages = ceil($total_records / $limit);

        $page = max($page, 1);

        $page = min($page, $total_pages);

        $offset = ($page -1) * $limit;


        
        $pagi_obj= new stdClass;

        $pagi_obj->total_pages = $total_pages;

        $pagi_obj->offset = $offset;

        $pagi_obj->limit = $limit;

        $pagi_obj->page;



        return $pagi_obj;

        

    }  

    
}


Why do the author used a stdClass ?
What are the advantages of using a stdClass?

Since we are already inside a class, why do we need to create a new object
from another class, inside this one? 
Why do we keep the values passed as params on method Pagination inside this
stdClass object, and not inside Pagination own properties for example? 

Any help clarifying this, knowing that I'm a newbie,

Regards,
Márcio


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to