Jump to content

My first class


Lingo
Go to solution Solved by Lingo,

Recommended Posts

So here is the Class:

<?php


/*
 * Game Name - Copyright 2013-2014;
 * This page will be
 * and open the template in the editor.
 */

/**
 * Author of Training
 *
 * @author Lingo Muwahaha
 */
 
class trainSloppyCheeseMen{  // Set Class

	
    public $type; // Unit Type
    public $amt; // Amount per Unit
    public $turns; // How much time will it take
    public $id; // Get user id 
	
    public function doTrainSloppyCheeseMen(){
	
/* @var $type type */
        if($type=="miners"){
	
            $player = R::load('user', $id);

             echo $this->id;


         	$new_price = bcmul($amt, 6000); // Create overall price by multiplication
				
	}
	
	}
	
	

}

?>

And here is the main page that calls the class:

 

<?php require_once("config.php");




include("classes/trainSloppyCheeseMen.class.php"); // Get new Class


         $trainSloppyCheeseMen = new trainSloppyCheeseMen(); // Get train class
         $sloppyCheeseLock = new sloppyCheeseLock(); // Get sql inject scrubber.
		 
		 

            $trainSloppyCheeseMen->type = "miners"; // Type is Miner
	    $sloppyID = 22;

	die($sloppyID);	

/* @var $sloppyProtect type */
       $sloppyCheeseLock->vulnerable = $_POST['miner_amt'];

$sloppyProtect = $sloppyCheeseLock->sloppyUniverseProtect();
				
				
            $trainSloppyCheeseMen->amt = $sloppyProtect;// Amount to Train
            $trainSloppyCheeseMen->turns = 1; // How many turns to train these buggers
            $trainSloppyCheeseMen->plasma = $player->plasma;
            $trainSloppyCheeseMen->id = $sloppyID;
		
			
	   $trainSloppyCheeseMen->doTrainSloppyCheeseMen(); 
	   
	   
	   	

?>


Ok when I try to die the $sloppyID nothing is outputed?

This makes no Sense. Am I doing something wrong? I know this is my first time working with classes. If you need the config.php file let me know.

 

Thanks,

Lingo

Edited by Lingo
Link to comment
Share on other sites

From the manual.

 

If status is a string, this function prints the status just before exiting.

If status is an integer, that value will be used as the exit status and not printed. Exit statuses should be in the range 0 to 254, the exit status 255 is reserved by PHP and shall not be used. The status 0 is used to terminate the program successfully.

 

 

Die() handles integers differently than strings.

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.