Login   Register  
PHP Classes
elePHPant
Icontem

File: factorial.vxml.php

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us
  Classes of Ben Yacoub Hatem  >  VXML  >  factorial.vxml.php  >  Download  
File: factorial.vxml.php
Role: Example script
Content type: text/plain
Description: factorial sample
Class: VXML
generate easily VXML document
Author: By
Last change: Added some change based on the version 1.0.1 of the class
Date: 12 years ago
Size: 1,260 bytes
 

Contents

Class file image Download
<?php

    
////////////////////////////////////////////////////////////////////
    ///
    ///             Sample usage of vxml.class.php
    ///            To calculate the factorial value of a number
    ///
    ////////////////////////////////////////////////////////////////////
    
    
include ("vxml.class.php");
    
    
$vxml_object=new voicexml;
    
    
$vxml_object->start_vxml_header($lang="fr");
    
    
$vxml_object->vxml_start_script();
    
    
$vxml_object->addscript"
       function factorial(n)\n
       {
       \treturn (n <= 1)? 1 : n * factorial(n-1);\n
       }\n"
;
       
    
$vxml_object->end_vxml_script();
    
    
$vxml_object->vxml_start_form("form");
    
        
$vxml_object->vxml_start_field("fact","","","number");
    
            
$vxml_object->vxml_prompt("Tell me a number and I'll tell you its factorial.");
    
            
$vxml_object->vxml_start_filled();
    
                
$vxml_object->vxml_start_prompt();
                
                
$vxml_object->vxml_start_value("fact");
                
                
$vxml_object->addtext(" factorial is ");
                
                
$vxml_object->vxml_start_value("factorial(fact)");
                
            
$vxml_object->end_vxml_prompt();
    
            
$vxml_object->end_vxml_filled();
    
        
$vxml_object->end_vxml_field();
        
    
$vxml_object->end_vxml_form();
    
    
$vxml_object->end_vxml();

    
$vxml_object->generate();
        
?>