The variable $var is passed through 3 functions below:
1. mysqli_real_escape_string()
2. trim()
3. strtolower()
Example 1 passes $var through nested functions:
$var = mysqli_real_escape_string($dbc, trim(strtolower($_POST['hello_world'])));
Example 2 uses step by step method of passing the $var to the 3 functions:
$var = mysqli_real_escape_string($dbc, $_POST['helloworld']);
$var = trim($var);
$var = strtolower($var);
I'm not even sure if Example 2 might have problems, or if any of you had any instances where this method didn't work. My concern with Example 1 is that what if I had about 5 functions to pass $var too, it would be a really long nested line. I know also I can create a custom function containing the 5 functions, but in some cases it's not necessary.
Any advice appreciated
Thanks,
Mark