Jump to content

Cross class scripting...


WhiteyDude

Recommended Posts

Note: I don't think anyone checks the O.O.P. section... There arn't many posts or reads there... It's fine if someone wants to delete the original topic there :).

 

 

Hi guys,

 

 

I have a quick but relatively urgent question.

 

I have 2 classes here, and I wish to call a function that's inside one of them from another.

 

Example code:

 

 

Main page:

<?php
$class1 = new Class1();

$class2 = new Class2();

$class1->function1();
?>

 

Class 1

<?php
class Class1 {
    function Class1() {}

    function function1()
    {
        //THIS is the line I'm having a problem with
        Class2::class2function();
    }

}
?>

 

Class 2

<?php
class Class2 {
    function Class2() {}

    function class2function()
    {
         echo "Worked!";
    }
}
?>

 

 

Another problem is that on the apache server I'm running (2.2.4, local) I'm unable to display PHP errors. I've tried everything I can think of - the PHP ini is starting to get worn, it's been modified so many times. PHP 5.2.1 by the way.

 

 

Please help guys, I need this fixed within the next hour or so.

 

 

Thanks,

 

 

 

 

/Whitey

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.