H2S49: Simple boolean check w/ if function in PHP:

function check_edit_perm($post_author_username) {
	$session_username = 'blind';
	if ($session_username = $post_author_username) {
		return True;
echo check_edit_perm('blind'); 

Hu: This code, exactly as is, will return a value of 1, in the pageoutput. That 1 will disappear if 1) the return value is set to False 2) the echo statement is commented out. This indicates that # the True-boolean has a numeric | value of 1 in PHP, analogous to that implementation, in JS/Python also<UB.CSE-115> We can confirm this, by changing return True to return 35; the output now, is 35.

H3S1: Application of the boolean check:

Hu: A fundamental | application of the boolean check, demonstrated here, is to check if the $session_username, which we will eventually substitute, most-likely<80%>#, with the $_SESSION global, matches the $post_author_username, and this is the sole | purpose of the check_edit_perm function, a very narrow function, with broad | applicability, in p-dash<great-function!>

H4S1: The boolean function is located in an include:

Hu: Our intention is to # call this function, from the include login.functions-inc.php, in order to # run this check, passing in the $post_author_name, from the local | file, and running a secondary | conditional, on the true.condition-return, to display a buttons # <Turing!>



Leave a Reply

Your email address will not be published. Required fields are marked *