Page 87 - Programador-PHP
P. 87

Programación Procedural de Aplicaciones Web de baja complejidad
        PHP Experto – Tomo I                                                                                                                                                  Eugenia Bahit

                http://www.php.net/manual/es/function.func-num-
                args.php

            •   Sobre func_get_args
                http://www.php.net/manual/es/function.func-get-args.php

            •   Sobre func_get_arg
                http://www.php.net/manual/es/function.func-get-arg.php


            •   Sobre is_callable
                http://www.php.net/manual/es/function.is-callable.php

            •   Sobre function_exists (alternativa a is_callable que solo
                comprueba si la función existe o no, pero no verifica que
                ésta, pueda ser llamada)

                http://www.php.net/manual/es/function.function-
                exists.php





        Diferentes formas de recoger
        argumentos para hacer una llamada de
        retorno


        Veremos   aquí,   dos   formas   de   crear   funciones   para   hacer
        llamadas de retorno que requieran de argumentos.


        Forma 1: recibir argumentos en un array

          // función callable
          function callable_func_1($arg1, $arg2, $arg3) {
              $result = ($arg1 + $arg2) * $arg3;
              return $result;
          }
          // función que hará la llamada de retorno
          function forma_1($funcion, $argumentos=array()) {
              $result = NULL;



                                              87
   82   83   84   85   86   87   88   89   90   91   92