FUDforum
Fast Uncompromising Discussions. FUDforum will get your users talking.

Home » Imported messages » comp.lang.php » functions in a external file
Show: Today's Messages :: Polls :: Message Navigator
Switch to threaded view of this topic Create a new topic Submit Reply
functions in a external file [message #173959] Mon, 16 May 2011 00:35 Go to next message
bruceaj is currently offline  bruceaj
Messages: 30
Registered: September 2010
Karma: 0
Member
Is there a maximum number of functions that can be contained in
"require_once" php file?

I have this simple function (for testing this problem).

function GetTelephoneNumber () {

return "123 456-6789";
}

If this function is in my main routine. No problem.
If this function is in it's own file. No problem.
If this function is in my main "function.php" file, I get the php
blank. screen. l am using firefox and don't know how to get errors.

Appreciate help and suggestions....

Thanks...

Bruce
Re: functions in a external file [message #173960 is a reply to message #173959] Mon, 16 May 2011 00:48 Go to previous messageGo to next message
Jerry Stuckle is currently offline  Jerry Stuckle
Messages: 2598
Registered: September 2010
Karma: 0
Senior Member
On 5/15/2011 8:35 PM, bruceaj wrote:
> Is there a maximum number of functions that can be contained in
> "require_once" php file?
>
> I have this simple function (for testing this problem).
>
> function GetTelephoneNumber () {
>
> return "123 456-6789";
> }
>
> If this function is in my main routine. No problem.
> If this function is in it's own file. No problem.
> If this function is in my main "function.php" file, I get the php
> blank. screen. l am using firefox and don't know how to get errors.
>
> Appreciate help and suggestions....
>
> Thanks...
>
> Bruce

No limit, other than the amount of code which has to be parsed.

You have another problem. Enable error reporting and see what you get
for an error. You probably are not including the file properly.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex(at)attglobal(dot)net
==================
Re: functions in a external file [message #173961 is a reply to message #173960] Mon, 16 May 2011 01:18 Go to previous messageGo to next message
bruceaj is currently offline  bruceaj
Messages: 30
Registered: September 2010
Karma: 0
Member
On May 15, 8:48 pm, Jerry Stuckle <jstuck...@attglobal.net> wrote:
> On 5/15/2011 8:35 PM, bruceaj wrote:
>
>
>
>> Is there a maximum number of functions that can be contained in
>> "require_once" php file?
>
>> I have this simple function (for testing this problem).
>
>> function GetTelephoneNumber () {
>
>>    return "123 456-6789";
>> }
>
>> If this function is in my main routine. No problem.
>> If this function is in it's own file. No problem.
>> If this function is in my main "function.php" file, I get the php
>> blank. screen. l am using firefox and don't know how to get errors.
>
>> Appreciate help and suggestions....
>
>> Thanks...
>
>> Bruce
>
> No limit, other than the amount of code which has to be parsed.
>
> You have another problem.  Enable error reporting and see what you get
> for an error.  You probably are not including the file properly.
>
> --
> ==================
> Remove the "x" from my email address
> Jerry Stuckle
> JDS Computer Training Corp.
> jstuck...@attglobal.net
> ==================

Thanks for the response.

I just checked the FIreFox menu items and didn't find where to enable
error reporting. Where do I find the option to enable error
reporting??

My main included file (functions.php} works perfectly when the above
routine NOT in it. So I would think my require_once set up must be
correct???
If I put it in another file, and include that file, the routine works.

What does your statement "No limit, other than the amount of code
which has to be parsed. " mean? Does it mean there is file byte size
limitation??


Thanks..

Bruce
Re: functions in a external file [message #173962 is a reply to message #173959] Mon, 16 May 2011 01:16 Go to previous messageGo to next message
Jeff North is currently offline  Jeff North
Messages: 58
Registered: November 2010
Karma: 0
Member
On Sun, 15 May 2011 17:35:41 -0700 (PDT), in comp.lang.php bruceaj
<bruceaj(at)bellsouth(dot)net>
<b563cc5a-aff9-4038-b4af-9368abfd65cb(at)r20g2000yqd(dot)googlegroups(dot)com>
wrote:

> | Is there a maximum number of functions that can be contained in
> | "require_once" php file?
> |
> | I have this simple function (for testing this problem).
> |
> | function GetTelephoneNumber () {
> |
> | return "123 456-6789";
> | }
> |
> | If this function is in my main routine. No problem.
> | If this function is in it's own file. No problem.
> | If this function is in my main "function.php" file, I get the php
> | blank. screen. l am using firefox and don't know how to get errors.
> |
> | Appreciate help and suggestions....
> |
> | Thanks...
> |
> | Bruce

You are just returning a value so you might need:
echo GetTelephoneNumber();
or
function GetTelephoneNumber() {
echo "123 456-6789";
}
The supplied code is for guideline purposes only.
Re: functions in a external file [message #173963 is a reply to message #173959] Mon, 16 May 2011 01:22 Go to previous messageGo to next message
Michael Fesser is currently offline  Michael Fesser
Messages: 215
Registered: September 2010
Karma: 0
Senior Member
.oO(bruceaj)

> Is there a maximum number of functions that can be contained in
> "require_once" php file?
>
> I have this simple function (for testing this problem).
>
> function GetTelephoneNumber () {
>
> return "123 456-6789";
> }
>
> If this function is in my main routine. No problem.
> If this function is in it's own file. No problem.
> If this function is in my main "function.php" file, I get the php
> blank. screen. l am using firefox and don't know how to get errors.

If you get a blank result, it's most likely a parse error. Check if your
error reporting is properly configured in your php.ini:

error_reporting = E_ALL|E_STRICT
display_errors = on

Micha
Re: functions in a external file [message #173964 is a reply to message #173962] Mon, 16 May 2011 01:26 Go to previous messageGo to next message
bruceaj is currently offline  bruceaj
Messages: 30
Registered: September 2010
Karma: 0
Member
On May 15, 9:16 pm, Jeff North <jnort...@yahoo.com.au> wrote:
> On Sun, 15 May 2011 17:35:41 -0700 (PDT), in comp.lang.php bruceaj
> <bruc...@bellsouth.net>
> <b563cc5a-aff9-4038-b4af-9368abfd6...@r20g2000yqd.googlegroups.com>
> wrote:
>
>
>
>> | Is there a maximum number of functions that can be contained in
>> | "require_once" php file?
>> |
>> | I have this simple function (for testing this problem).
>> |
>> | function GetTelephoneNumber () {
>> |
>> |   return "123 456-6789";
>> | }
>> |
>> | If this function is in my main routine. No problem.
>> | If this function is in it's own file. No problem.
>> | If this function is in my main "function.php" file, I get the php
>> | blank. screen. l am using firefox and don't know how to get errors.
>> |
>> | Appreciate help and suggestions....
>> |
>> | Thanks...
>> |
>> | Bruce
>
> You are just returning a value so you might need:
> echo GetTelephoneNumber();
> or
> function GetTelephoneNumber() {
>   echo "123 456-6789";}
>
> The supplied code is for guideline purposes only.

This is just a test routine. The final routine has calling arguments
and accesses a mysql database to get the telephone number.

I tested your suggestions. They didn't do what I am trying to. Thanks
for sending them..

Thanks for the response....

Bruce
Re: functions in a external file [message #173965 is a reply to message #173963] Mon, 16 May 2011 01:48 Go to previous messageGo to next message
bruceaj is currently offline  bruceaj
Messages: 30
Registered: September 2010
Karma: 0
Member
On May 15, 9:22 pm, Michael Fesser <neti...@gmx.de> wrote:
> .oO(bruceaj)
>
>> Is there a maximum number of functions that can be contained in
>> "require_once" php file?
>
>> I have this simple function (for testing this problem).
>
>> function GetTelephoneNumber () {
>
>>    return "123 456-6789";
>> }
>
>> If this function is in my main routine. No problem.
>> If this function is in it's own file. No problem.
>> If this function is in my main "function.php" file, I get the php
>> blank. screen. l am using firefox and don't know how to get errors.
>
> If you get a blank result, it's most likely a parse error. Check if your
> error reporting is properly configured in your php.ini:
>
> error_reporting = E_ALL|E_STRICT
> display_errors = on
>
> Micha

I have these values in my php.ini.

Yes, the blank result appears to be a parsing error BUT I can cut the
function from my main include_once("functions.php") file and paste it
into another include_once("functions2.php") file and all work good.
STRANGE to me??

Thanks for the response...

Bruce
Re: functions in a external file [message #173966 is a reply to message #173961] Mon, 16 May 2011 02:13 Go to previous messageGo to next message
Jerry Stuckle is currently offline  Jerry Stuckle
Messages: 2598
Registered: September 2010
Karma: 0
Senior Member
On 5/15/2011 9:18 PM, bruceaj wrote:
> On May 15, 8:48 pm, Jerry Stuckle<jstuck...@attglobal.net> wrote:
>> On 5/15/2011 8:35 PM, bruceaj wrote:
>>
>>
>>
>>> Is there a maximum number of functions that can be contained in
>>> "require_once" php file?
>>
>>> I have this simple function (for testing this problem).
>>
>>> function GetTelephoneNumber () {
>>
>>> return "123 456-6789";
>>> }
>>
>>> If this function is in my main routine. No problem.
>>> If this function is in it's own file. No problem.
>>> If this function is in my main "function.php" file, I get the php
>>> blank. screen. l am using firefox and don't know how to get errors.
>>
>>> Appreciate help and suggestions....
>>
>>> Thanks...
>>
>>> Bruce
>>
>> No limit, other than the amount of code which has to be parsed.
>>
>> You have another problem. Enable error reporting and see what you get
>> for an error. You probably are not including the file properly.
>>
>> --
>> ==================
>> Remove the "x" from my email address
>> Jerry Stuckle
>> JDS Computer Training Corp.
>> jstuck...@attglobal.net
>> ==================
>
> Thanks for the response.
>
> I just checked the FIreFox menu items and didn't find where to enable
> error reporting. Where do I find the option to enable error
> reporting??
>
> My main included file (functions.php} works perfectly when the above
> routine NOT in it. So I would think my require_once set up must be
> correct???
> If I put it in another file, and include that file, the routine works.
>
> What does your statement "No limit, other than the amount of code
> which has to be parsed. " mean? Does it mean there is file byte size
> limitation??
>
>
> Thanks..
>
> Bruce

It's in your php.ini file - the browser can't do anything to control
server-side errors.

Ensure they are actually on - set up a file with just:

<?php
phpinfo();
?>

And see if your error reporting and display are really on. They may be
overridden - or you may be using an entirely different php.ini file than
you think.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex(at)attglobal(dot)net
==================
Re: functions in a external file [message #173968 is a reply to message #173966] Mon, 16 May 2011 03:42 Go to previous messageGo to next message
bruceaj is currently offline  bruceaj
Messages: 30
Registered: September 2010
Karma: 0
Member
On May 15, 10:13 pm, Jerry Stuckle <jstuck...@attglobal.net> wrote:
> On 5/15/2011 9:18 PM, bruceaj wrote:
>
>
>
>> On May 15, 8:48 pm, Jerry Stuckle<jstuck...@attglobal.net>  wrote:
>>> On 5/15/2011 8:35 PM, bruceaj wrote:
>
>>>> Is there a maximum number of functions that can be contained in
>>>> "require_once" php file?
>
>>>> I have this simple function (for testing this problem).
>
>>>> function GetTelephoneNumber () {
>
>>>>     return "123 456-6789";
>>>> }
>
>>>> If this function is in my main routine. No problem.
>>>> If this function is in it's own file. No problem.
>>>> If this function is in my main "function.php" file, I get the php
>>>> blank. screen. l am using firefox and don't know how to get errors.
>
>>>> Appreciate help and suggestions....
>
>>>> Thanks...
>
>>>> Bruce
>
>>> No limit, other than the amount of code which has to be parsed.
>
>>> You have another problem.  Enable error reporting and see what you get
>>> for an error.  You probably are not including the file properly.
>
>>> --
>>> ==================
>>> Remove the "x" from my email address
>>> Jerry Stuckle
>>> JDS Computer Training Corp.
>>> jstuck...@attglobal.net
>>> ==================
>
>> Thanks for the response.
>
>> I just checked the FIreFox menu items and didn't find where to enable
>> error reporting.  Where do I find the option to enable error
>> reporting??
>
>> My main included file (functions.php} works perfectly when the above
>> routine NOT in it. So I would think my require_once set up must be
>> correct???
>> If I put it in another file, and include that file, the routine works.
>
>> What does your statement "No limit, other than the amount of code
>> which has to be parsed. " mean?  Does it mean there is file byte size
>> limitation??
>
>> Thanks..
>
>> Bruce
>
> It's in your php.ini file - the browser can't do anything to control
> server-side errors.
>
> Ensure they are actually on - set up a file with just:
>
> <?php
> phpinfo();
> ?>
>
> And see if your error reporting and display are really on.  They may be
> overridden - or you may be using an entirely different php.ini file than
> you think.
>
> --
> ==================
> Remove the "x" from my email address
> Jerry Stuckle
> JDS Computer Training Corp.
> jstuck...@attglobal.net
> ==================

I thought I had changed the values but they didn't take. I had to
restart Windows to make them take effect unless restarting was
overkill..

I had some errors in use date() which I fixed and my original error
went away.

Thanks all for the help...

Bruce
Re: functions in a external file [message #173969 is a reply to message #173959] Mon, 16 May 2011 08:24 Go to previous messageGo to next message
Denis McMahon is currently offline  Denis McMahon
Messages: 634
Registered: September 2010
Karma: 0
Senior Member
On Sun, 15 May 2011 17:35:41 -0700, bruceaj wrote:

> If this function is in my main routine. No problem. If this function is
> in it's own file. No problem. If this function is in my main
> "function.php" file, I get the php blank. screen. l am using firefox and
> don't know how to get errors.

You've put the function definition inside another function definition
because you have a mix of bracketing styles and have become confused
about where the braces go?

Rgds

Denis McMahon
Re: functions in a external file [message #173971 is a reply to message #173968] Mon, 16 May 2011 11:00 Go to previous messageGo to next message
Jerry Stuckle is currently offline  Jerry Stuckle
Messages: 2598
Registered: September 2010
Karma: 0
Senior Member
On 5/15/2011 11:42 PM, bruceaj wrote:
> On May 15, 10:13 pm, Jerry Stuckle<jstuck...@attglobal.net> wrote:
>> On 5/15/2011 9:18 PM, bruceaj wrote:
>>
>>
>>
>>> On May 15, 8:48 pm, Jerry Stuckle<jstuck...@attglobal.net> wrote:
>>>> On 5/15/2011 8:35 PM, bruceaj wrote:
>>
>>>> > Is there a maximum number of functions that can be contained in
>>>> > "require_once" php file?
>>
>>>> > I have this simple function (for testing this problem).
>>
>>>> > function GetTelephoneNumber () {
>>
>>>> > return "123 456-6789";
>>>> > }
>>
>>>> > If this function is in my main routine. No problem.
>>>> > If this function is in it's own file. No problem.
>>>> > If this function is in my main "function.php" file, I get the php
>>>> > blank. screen. l am using firefox and don't know how to get errors.
>>
>>>> > Appreciate help and suggestions....
>>
>>>> > Thanks...
>>
>>>> > Bruce
>>
>>>> No limit, other than the amount of code which has to be parsed.
>>
>>>> You have another problem. Enable error reporting and see what you get
>>>> for an error. You probably are not including the file properly.
>>
>>>> --
>>>> ==================
>>>> Remove the "x" from my email address
>>>> Jerry Stuckle
>>>> JDS Computer Training Corp.
>>>> jstuck...@attglobal.net
>>>> ==================
>>
>>> Thanks for the response.
>>
>>> I just checked the FIreFox menu items and didn't find where to enable
>>> error reporting. Where do I find the option to enable error
>>> reporting??
>>
>>> My main included file (functions.php} works perfectly when the above
>>> routine NOT in it. So I would think my require_once set up must be
>>> correct???
>>> If I put it in another file, and include that file, the routine works.
>>
>>> What does your statement "No limit, other than the amount of code
>>> which has to be parsed. " mean? Does it mean there is file byte size
>>> limitation??
>>
>>> Thanks..
>>
>>> Bruce
>>
>> It's in your php.ini file - the browser can't do anything to control
>> server-side errors.
>>
>> Ensure they are actually on - set up a file with just:
>>
>> <?php
>> phpinfo();
>> ?>
>>
>> And see if your error reporting and display are really on. They may be
>> overridden - or you may be using an entirely different php.ini file than
>> you think.
>>
>
> I thought I had changed the values but they didn't take. I had to
> restart Windows to make them take effect unless restarting was
> overkill..
>
> I had some errors in use date() which I fixed and my original error
> went away.
>
> Thanks all for the help...
>
> Bruce

You don't need to restart Windows, but you do need to restart the web
server. Your php.ini is only read on web server startup, not every request.


--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex(at)attglobal(dot)net
==================
Re: functions in a external file [message #173973 is a reply to message #173959] Mon, 16 May 2011 11:49 Go to previous messageGo to next message
The Natural Philosoph is currently offline  The Natural Philosoph
Messages: 993
Registered: September 2010
Karma: 0
Senior Member
bruceaj wrote:
> Is there a maximum number of functions that can be contained in
> "require_once" php file?
>
> I have this simple function (for testing this problem).
>
> function GetTelephoneNumber () {
>
> return "123 456-6789";
> }
>
> If this function is in my main routine. No problem.
> If this function is in it's own file. No problem.
> If this function is in my main "function.php" file, I get the php
> blank. screen. l am using firefox and don't know how to get errors.
>
> Appreciate help and suggestions....
>
> Thanks...
>
> Bruce
syntax error somewhere.
Re: functions in a external file [message #173979 is a reply to message #173973] Mon, 16 May 2011 17:34 Go to previous messageGo to next message
bruceaj is currently offline  bruceaj
Messages: 30
Registered: September 2010
Karma: 0
Member
On May 16, 7:49 am, The Natural Philosopher <t...@invalid.invalid>
wrote:
> bruceaj wrote:
>> Is there a maximum number of functions that can be contained in
>> "require_once" php file?
>
>> I have this simple function (for testing this problem).
>
>> function GetTelephoneNumber () {
>
>>    return "123 456-6789";
>> }
>
>> If this function is in my main routine. No problem.
>> If this function is in it's own file. No problem.
>> If this function is in my main "function.php" file, I get the php
>> blank. screen. l am using firefox and don't know how to get errors.
>
>> Appreciate help and suggestions....
>
>> Thanks...
>
>> Bruce
>
> syntax error somewhere.

It appears that all is good. Turn on error_reporting showed up a
couple of date problems.

1. I was using H in date() and not "H". Fixed.
2. The error_reporting wanted me to use date_default_timezone_set()
and not accept the default time zone. Fixed.

Still seems strange that my test routine, which had nothing within the
function definition brackets but "return '123455'; would stop all the
functions I had defined from working.

Oh, well. All's well that end's well. Thanks to all for the help and
suggestions...

Bruce
Re: functions in a external file [message #173980 is a reply to message #173969] Mon, 16 May 2011 17:36 Go to previous messageGo to next message
bruceaj is currently offline  bruceaj
Messages: 30
Registered: September 2010
Karma: 0
Member
On May 16, 4:24 am, Denis McMahon <denis.m.f.mcma...@gmail.com> wrote:
> On Sun, 15 May 2011 17:35:41 -0700, bruceaj wrote:
>> If this function is in my main routine. No problem. If this function is
>> in it's own file. No problem. If this function is in my main
>> "function.php" file, I get the php blank. screen. l am using firefox and
>> don't know how to get errors.
>
> You've put the function definition inside another function definition
> because you have a mix of bracketing styles and have become confused
> about where the braces go?
>
> Rgds
>
> Denis McMahon

No, I didn't do this. Sorry if my explanation led you to think I
did.. I have multiple functions defined with the file named
"functions.php".

Thanks for the response...

Bruce
Re: functions in a external file [message #173981 is a reply to message #173979] Mon, 16 May 2011 18:43 Go to previous messageGo to next message
Jerry Stuckle is currently offline  Jerry Stuckle
Messages: 2598
Registered: September 2010
Karma: 0
Senior Member
On 5/16/2011 1:34 PM, bruceaj wrote:
> On May 16, 7:49 am, The Natural Philosopher<t...@invalid.invalid>
> wrote:
>> bruceaj wrote:
>>> Is there a maximum number of functions that can be contained in
>>> "require_once" php file?
>>
>>> I have this simple function (for testing this problem).
>>
>>> function GetTelephoneNumber () {
>>
>>> return "123 456-6789";
>>> }
>>
>>> If this function is in my main routine. No problem.
>>> If this function is in it's own file. No problem.
>>> If this function is in my main "function.php" file, I get the php
>>> blank. screen. l am using firefox and don't know how to get errors.
>>
>>> Appreciate help and suggestions....
>>
>>> Thanks...
>>
>>> Bruce
>>
>> syntax error somewhere.
>
> It appears that all is good. Turn on error_reporting showed up a
> couple of date problems.
>
> 1. I was using H in date() and not "H". Fixed.
> 2. The error_reporting wanted me to use date_default_timezone_set()
> and not accept the default time zone. Fixed.
>
> Still seems strange that my test routine, which had nothing within the
> function definition brackets but "return '123455'; would stop all the
> functions I had defined from working.
>
> Oh, well. All's well that end's well. Thanks to all for the help and
> suggestions...
>
> Bruce

A parse error is a fatal error. And since everything must be parsed
before any processing takes place, no code will be executed.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex(at)attglobal(dot)net
==================
Re: functions in a external file [message #173982 is a reply to message #173971] Mon, 16 May 2011 20:04 Go to previous message
Thomas Mlynarczyk is currently offline  Thomas Mlynarczyk
Messages: 131
Registered: September 2010
Karma: 0
Senior Member
Jerry Stuckle schrieb:

> You don't need to restart Windows, but you do need to restart the web
> server. Your php.ini is only read on web server startup, not every
> request.

Depends on the setup. If PHP runs as CGI, php.ini is read on every request.

Greetings,
Thomas


--
Ce n'est pas parce qu'ils sont nombreux à avoir tort qu'ils ont raison!
(Coluche)
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Stats comp.lang.php (last 7 days)
Next Topic: some of the issues of NOT storing images in a secure database..
Goto Forum:
  

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ]

Current Time: Sat Nov 30 06:22:35 GMT 2024

Total time taken to generate the page: 0.03335 seconds