Jump to content

My first class


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

Link to comment
https://forums.phpfreaks.com/topic/283709-my-first-class/
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
https://forums.phpfreaks.com/topic/283709-my-first-class/#findComment-1457482
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.