I've checked around stackoverflow and there are a few questions in this regard which doesn't seem to be addressed.
I have this code
<?php
function secret() {
return "My secret is, I love apples";
}
function add($a, $b) {
return $a + b;
}
$a = strlen($_GET["a"]); // We assume they always have "a" set
echo add($a, 10);
Question 1: Can a user, use ajax to call my secret function and know my secret? To my understanding you can use ajax to call any PHP function. So someone can find out my secret is they know what the function is called.
Question 2: How can a php function be coded so it is uncallable through ajax? Essentially I do not what a user to call php functions themselves at all. I want it to be done purely on the server side.