我喜欢通过正确的方式编写简洁的代码。这是我的问题,当编写PHP代码(程序)时,你将函数调用与函数定义放在一起。
例如:
if( isset( $_POST['submit_form'] ) )
{
//Here is function definition
test_input($data)
{
$data = trim($data);
$data = stripslashes($data)
.......
}
//Here I am making function calls
$name = test_input( $_POST['username'] );
$emailid = test_input( $_POST['useremail'] );
和
if( isset( $_POST['submit_form'] ) )
{
//Here I am making function calls
$name = test_input( $_POST['username'] );
$emailid = test_input( $_POST['useremail'] );
//Here is function definition
test_input($data)
{
$data = trim($data);
$data = stripslashes($data)
.......
}