terryds Posted May 24, 2013 Share Posted May 24, 2013 I see some php files contain the ?> closing tag, but some don't... What's the difference between putting it and not putting it ? Link to comment Share on other sites More sharing options...
buzzycoder Posted May 24, 2013 Share Posted May 24, 2013 (edited) If you're using php code in between html code like below : <html><head><title>Test</title></head><body><?phpecho "Hello";?></body></html> Then,it should have closing tag (?>).But,if you're entering only php code in it then without closing too it would run like below: <?phpecho "Hello";?> Hope this got you a answer ! Edited May 24, 2013 by buzzycoder Link to comment Share on other sites More sharing options...
justsomeguy Posted May 24, 2013 Share Posted May 24, 2013 The closing tag for PHP is optional. If you have a file with only PHP code in it, with no HTML, then it makes sense not to bother with the closing tag. For example: <?php/*** For content that is a SCO of a multisco package, use the password of its parent content instead of its own.*/$sql = 'SELECT c.password, pc.password as parent_password, c.parent_id FROM `content` c' . ' LEFT JOIN content pc ON c.parent_id = pc.id' . " WHERE c.id = $id";$db->sql($sql);$row = $db->select();$password = $row[0]['parent_id'] > 0 ? $row[0]['parent_password'] : $row[0]['password'];if ($password === form_var('content_password')) { $response['success'] = true; $response['valid'] = true; // password is correct, set it in session so content can check it on launch. $sess->set_val('content_password', sha1($password)); return;}else { $response['errors']['reason'] = $lang->get_string('passwd_not_correct'); $response['success'] = false; return;} Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now