Hello
sorry for the English if it's horrible
so, I was wondering what is the best (fastest, secure) way to load a php script, is it to load the script in a function in the top and run it, or to execute each if ,else in the middle of the code.
example 1
<?php
function load_script(){
if (isset($_POST['query'])){
$php = $_POST['query']; # do things ....
}
else { # do things .... }
# rest of the script ...
}
?>
<html>
<head>
<title></title>
</head>
<body>
<?php load_script(); ?>
</body>
</html>
example 2
<?php
function load_script(){
if (isset($_POST['query'])){
$php = $_POST['query']; # do things ....
}
else { # do things .... }
# rest of the script ...
}
?>
<html>
<head>
<title></title>
</head>
<body>
<?php load_script(); ?>
</body>
</html>
Thanks, Have a good day !