create $id
public $id = false;
then use
function a(){
$this->id = $this->input->post('id');
}
function b(){
if($this->id){.....}
}
in controls class
class TestApi extends MY_Controller {
public function __construct() {
parent::__construct();
}
public t1 = false;
public function a () {
$this->t1 = true;
}
public function b () {
a();
if($this->t1){
...
}
}
}
or try global var? but not a good idea in framework
$a1 = 5;
function Test()
{
$GLOBALS['a1'] = 1;
}
Test();
echo $a1;
In the Same Class? maybe should check var or what u get from input?
Class Test{
public $t = 1;
public function a(){
$this->t = 20;
}
public function b(){
echo $this->t;
}
}
$TestClass = new Test;
echo $TestClass->t;
echo "-";
echo $TestClass->a();
echo ">";
echo $TestClass->t;