Jump to content

calling a function inside a function


blueman378

Recommended Posts

Hi guys, well im looking for a way to call a function inside a function or something similar.

 

basically im making a form generator, and im working on adding the elements

 

anyway i want a way to do something like

 

$formgenerator->addelement(addselect("name","filltype","size"))

to add a select box

or

$formgenerator->addelement(addtext("name","maxlength","size"))

and

$formgenerator->addelement(addemail("name","size"))

 

etc, is this possible or even

 

$formgenerator->addelement("select")

 

but then i would need a way to pass through the  values for the select as well

Link to comment
https://forums.phpfreaks.com/topic/135900-calling-a-function-inside-a-function/
Share on other sites

so say i have something like:

<?php

class formgenerator
{
var $elements = array();

function formgenerator()
{
	global $database;	
}

function addelement($function)
{
	function addselect($name, $size, $fill)
	{
		$elements = array(
			array(
				Type => "select",
				Name => $name, 
            		Size => $size,
            		fill => $fill 
            	)
            );	
	}
	function addtext($name, $size, $maxlength, $validationtype)
	{

	}
}

}
?>

 

how would i access addselect()?

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.