Lingo Posted November 8, 2013 Share Posted November 8, 2013 (edited) 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 November 8, 2013 by Lingo Quote Link to comment Share on other sites More sharing options...
KevinM1 Posted November 8, 2013 Share Posted November 8, 2013 die() is a built-in PHP function that kills script execution. You stop your script from executing right there. Quote Link to comment Share on other sites More sharing options...
Lingo Posted November 8, 2013 Author Share Posted November 8, 2013 I know that! But shouldnt it display 22? It displays nothing at all. Quote Link to comment Share on other sites More sharing options...
Lingo Posted November 8, 2013 Author Share Posted November 8, 2013 Hmm weirdly enough I change die($sloppyID); to die("".$sloppyID.""); and it dies 22. Which is really weird anyone know why this is happening? Quote Link to comment Share on other sites More sharing options...
newmarket Posted November 8, 2013 Share Posted November 8, 2013 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. Quote Link to comment Share on other sites More sharing options...
Solution Lingo Posted November 8, 2013 Author Solution Share Posted November 8, 2013 Haha I figured it out... I was not using <?php $this-> WHAT EVER; ?> I started using it inside the class and things cleared up Thanks. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.