0

I have a CodeIgniter function and inside it I have a PHP function. I can't get this PHP function to work. Please see the code below. The parameter of acmazdami($parameter) function is an array. Maybe it is something to do with that. Can anyone help. Best Regards and thank you in advance...

  public function pozisyon_tutma() {// CI function
    function acmazdami($parametre){//PHP function inside the CI function
    $dizi = array();
    $dizi = $parametre;
    print_r(array_values($dizi))."<br>";
    echo "Tamamdır <br>";
  }

The code that sends an array to the PHP function. It is also inside the same above mentioned CI function:

} else {
    echo "... kontrol...<br>";
    echo $aday_tas."<br> code has read until here";
    acmazdami(array ($vezir_yerleri));
}

The code doesn't give any errors but I can't get the line

print_r(array_values($dizi))."<br>";

to work. Regards...

Mihriban Minaz
  • 3,043
  • 2
  • 32
  • 52
Otag
  • 141
  • 11

2 Answers2

1

You have to do $this->acmazdami(your value) Add $this before the custom PHP function.

Mihriban Minaz
  • 3,043
  • 2
  • 32
  • 52
WebInsight
  • 307
  • 2
  • 20
  • public function acmazdami($parametre){ $dizi = array(); $dizi = $parametre; print_r(array_values($dizi))."
    "; echo "Tamamdır
    "; } and $this->acmazdami(array ($vezir_yerleri)); Did not have any effect. There are no errors. But the code doesn't produce the result of print_r(array_values($dizi))... Not even an empty array. Regards
    – Otag Apr 06 '16 at 14:19
1

In controller call the method in same class with $this->YOURMETHOD Don't Write method inside other method

public function_1()// CI function
{

 //  do something

}
public function_2()//CI function
{
      $this->function_1() // to access function_1 
}
Maninderpreet Singh
  • 2,569
  • 2
  • 17
  • 31