Board index   FAQ   Search  
Register  Login
Board index php forum :: php coding PHP coding => General

add php code in included file

Ask about general coding issues or problems here.

Moderators: macek, egami, gesf

add php code in included file

Postby nirav » Wed Mar 06, 2013 7:36 pm

hi, i have **abc.php** file in that

include('xyz.php');

// this have some code in abc.php like
php
{
'
'
'
}


now i want to add this code in included file xyz.php at some specific place..need help,it wlill be very helpful while changing templete,how to do this?
nirav
New php-forum User
New php-forum User
 
Posts: 1
Joined: Wed Mar 06, 2013 7:33 pm

Re: add php code in included file

Postby aravindoptimus » Thu Mar 07, 2013 3:25 am

Just specify the PHP code in the xyz.php file and include the file.
User avatar
aravindoptimus
New php-forum User
New php-forum User
 
Posts: 11
Joined: Thu Mar 07, 2013 2:00 am

Re: add php code in included file

Postby seandisanti » Thu Mar 07, 2013 12:11 pm

If it's code that is essential to your project's performance, make sure you require or require_once instead of include. Often it seems like people go with include to avoid the possibility of a fatal error if not found, but ignoring that error if it comes up will just lead to other issues that will make for a longer hunt for the root cause.
seandisanti
php-forum Fan User
php-forum Fan User
 
Posts: 838
Joined: Mon Oct 01, 2012 12:32 pm


Return to PHP coding => General

Who is online

Users browsing this forum: Google [Bot] and 4 guests

Sponsored by Sitebuilder Web hosting and Traduzioni Italiano Rumeno and antispam for cPanel.