1
Oki
Why we need use is_array on object constructor
  • 2003/10/24 10:56

  • Oki

  • Just popping in

  • Posts: 25

  • Since: 2002/12/4


Hi,

I have a big question. I have studied the code of XOOPS Classes, but i can't understand why we need to use the function is_array() if always the variable is replaced by the next array item.

I look in all code for an answer, but i can't find.

Is it a bug trap?

class.newsstory.php
    
function NewsStory($storyid=-1)
    {
        
$this->db =& Database::getInstance();
        
$this->table $this->db->prefix("stories");
        
$this->topicstable $this->db->prefix("topics");
        if (
is_array($storyid)) {
            
$this->makeStory($storyid);
            
$this->newstopic $this->topic();
        } elseif(
$storyid != -1) {
            
$this->getStory(intval($storyid));
            
$this->newstopic $this->topic();
        }
    }


On makeStory method in class XoopsStory we aren't get new instances of XoopsStory

(...)

function makeStory($array)
    {
        foreach ( 
$array as $key=>$value ){
            
$this->$key $value;
        }
    }



Best regards,
Celso Goya
moinho.net

Login

Who's Online

210 user(s) are online (139 user(s) are browsing Support Forums)


Members: 0


Guests: 210


more...

Donat-O-Meter

Stats
Goal: $100.00
Due Date: Apr 30
Gross Amount: $0.00
Net Balance: $0.00
Left to go: $100.00
Make donations with PayPal!

Latest GitHub Commits