php - How can I properly call any math related function in a class/controller? -


i tried use factorial php build in function gmp_fact() in 1 of function in class/controller.

i keep getting:

call undefined function app\http\controllers\gmp_fact()

does know why ? or how fix ?

how's come can use other functions strlen, str_split, , on ... ?

do need include kind of math library or ?


my controller

<?php  namespace app\http\controllers; use view, input, redirect;  class codecontroller extends controller {      public function getfactorial($num)     {         $fact = 1;         for($i = 1; $i <= $num ;$i++)             $fact = $fact * $i;         return $fact;     }      public function codingpuzzle()     {         return view::make('codes.puzzle');     }      public function codingpuzzleprocess()     {          $word     = strtoupper(input::get('word'));         $length   = strlen($word);         $max_value = ($length * 26);         $characters = str_split($word);          $num = 1 ;         $index = 1;          sort($characters);          //dd($characters);          foreach ( $characters $character) {             $num += gmp_fact($index) * $index;             $index ++;           }          return redirect::to('/coding-puzzle')             ->with('word', $word )             ->with('num', $num )             ->with('success','submit successfully!');      }   } 


Comments

Popular posts from this blog

1111. appearing after print sequence - php -

excel - I can't get the attachement of the email PHP -

node.js - Express and Redis - If session exists for this user, don't allow access -