Jump to content

im new here, need help .......... plz !!!!!!


Recommended Posts

Question 1: Is there any different between

 

<?php

 

?>

 

and

 

<?

 

?>

 

Question 2: As I understood “include” used for include any file. But sometime I saw “include_once” used in some file. But why????

 

Question 3: I saw some php file extension is “inc.php”, for example –

 

“db.inc.php” or “general.inc.php”

 

my question is what is the reason of using “inc.php”

 

 

plz plz help me !!!!!!!!!!!!!

 

 

Link to comment
https://forums.phpfreaks.com/topic/146731-im-new-here-need-help-plz/
Share on other sites

Questions one, yes <? can be turned off. It is better to use <?php

 

Question two, include_once means it will only include that file once, even if called 5 times. This prevents some errors etc.

 

Question three inc.php is just informing people that it is an include. It is not it's own extension, it just makes it easier in some cases to find out files that are included.

First and formost, you can find ALL of these answers in the PHP documentaion: http://www.php.net/manual/en/

 

Q1) <? ?> is just a "shorthand" way of doing <?php ?>. I would not recommend using the shorthand method though, because you can configure it to be off. So while your install of PHP might support it, if you take the code somewhere else, it may not work.

 

Q2) The PHP doc describes in detail the difference:

http://www.php.net/include/

http://www.php.net/include_once/

http://www.php.net/require/

http://www.php.net/require_once/

 

Q3) it's just a naming convention to show that the file is an "include" file. So, in essence it's a piece of code, versus an actual script that is executed.

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.