Re: [PHP] Server Side Include translator as PHP functions

2011-10-11 Thread tamouse mailing lists
On Sat, Oct 8, 2011 at 10:36 AM, Complex complex.confus...@gmail.com wrote:
 Can you please tell me if there's already a set of PHP functions for
 translating SSI commands to PHP?
 I'm looking to do two things -- one difficult, one easy -- using PHP
 on a hosted server.

I can't believe that this hasn't already been done -- there are
probably lots of sites that used SSI in legacy systems that eventually
went to PHP that something like this only makes sense as an interim
step. Yet I can't find anything (or it's buried too deep in google
that my -fu isn't working).

Basically what you want to do is translate SSI directives on the fly
in PHP, yes? includes, execs, other SSI functions. I can't see an easy
way to this without actually reading the file and making substitutions
in it as you spit it out to the client. It doesn't seem like
especially difficult code to write, it's just surprising I can't find
something that already does it.

I did this a long time ago in Perl, but that code is lost to time.

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Server Side Include translator as PHP functions

2011-10-11 Thread tamouse mailing lists
On Sun, Oct 9, 2011 at 12:36 PM, Tedd Sperling tedd.sperl...@gmail.com wrote:
 On Oct 9, 2011, at 11:41 AM, Complex wrote:

 Tedd,

 The crucial detail you're lookign for is my lack of choice or control
 in the matter, for all sorts of reasons that are actually quite stupid
 but not possible for *me* to change, and not possible for anyone else
 to change quickly. Thus I am looking for a solution to the problem at
 hand, instead of a suggestion for what the entire org should be doing
 instead. I know what they should be doing instead, but that's not my
 decision. It's not like I'm building a new website this way; I'm
 trying to move forwards with an existing and large website. The more
 different code-bases we have for different parts of the site, the
 harder it will be to actually change to something else (PHP-based, I
 pray).

 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php


 Without debating the question of choice, if I was confronted with a large web 
 site that used SSI, I would inform the client of such and put together a bid 
 as to my time to bring the site up to date. If not, then I think I would pass 
 on working the site. In my experience, it's not worth my additional time to 
 try to work around out of date technologies.

 It is also been my experience that when I am confronted with something large 
 scale, and when approved by the client, I simply do a site-wide find and 
 replace (namely change !--#include to ?php include) and then evaluate 
 all occurrences prior to changing. That usually gives me a good idea of the 
 breath of the problem.

 In addition, considering the !--#include has basically the same purpose as 
 ?php include, while it may be a wide-spread problem, I do not see it as a 
 serious problem to address. Certainly, when including files that have a 
 different suffix .shtml as compared to .php you will find that the Server 
 will treat them differently but that's pretty easy to fix -- just change the 
 files suffix or possibility write code in a .httacess file that would cause 
 the interpreter to consider shtml files the same a php.

 Of course, I may not fully understand the problem.

Of course, if it was just mapping includes, that would be too simple
to require much of a general solution. However SSI is more than just
includes. That's where it gets interesting.

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Server Side Include translator as PHP functions

2011-10-10 Thread Tedd Sperling
On Oct 9, 2011, at 7:43 PM, Tommy Pham wrote:

 On Sun, Oct 9, 2011 at 8:41 AM, Complex complex.confus...@gmail.com wrote:
 
 Tedd,
 
 The crucial detail you're lookign for is my lack of choice or control
 in the matter, for all sorts of reasons that are actually quite stupid
 but not possible for *me* to change, and not possible for anyone else
 to change quickly. Thus I am looking for a solution to the problem at
 hand, instead of a suggestion for what the entire org should be doing
 instead. I know what they should be doing instead, but that's not my
 decision. It's not like I'm building a new website this way; I'm
 trying to move forwards with an existing and large website. The more
 different code-bases we have for different parts of the site, the
 harder it will be to actually change to something else (PHP-based, I
 pray).
 
 
 At the time when I was working with ASP and SSI, I suggested my client to
 better rewrite the application in OOP language then do patchworks.  But he
 _insisted_ on keeping existing code base.  So I did patchworks here and
 there.  It got to the point where he finally wanted some additional features
 much later that it was impossible to do with ASP and SSI.  It was then that
 he finally decided to go with my suggestions, which is months later.  During
 that time, I could have easily rewritten the application in PHP.  That's why
 I suggested you to consider the site's function and features.  It maybe just
 one thing that the client/boss wants now, then another, and another...
 etc...  Eventually, you're going to through the same thing I did.
 
 Good luck,
 Tommy

Not me.

I pick and choose my clients based upon several things -- one is their ability 
to fully understand what they want. And if what they want exceeds their 
understanding and thus my comfort level, then I walk.

Live is too short to work for ignorant people. Realize that if they don't 
understand the job, then they won't appreciate the effort, and you won't be 
paid as you should.

Several years ago, one guy asked me how much do I charge. At that time I said 
$50 per hour He replied I've never paid more than $25 per hour -- would you 
consider working for that? I replied Sure, but it's going to take me twice as 
long to get anything done. Needless to say, I didn't get hired.

A year later he returned and we had the identical conversation again. It was 
clear that he didn't like the programmers he hired at $25 per hour, but he 
continued looking.

In addition to failing to get what he wanted, he didn't realized that his time 
is also worth something and he was wasting it by measuring programmers by a 
single metric. Some clients are simply not worth the effort and that's my point.

Cheers,

tedd

_
t...@sperling.com
http://sperling.com


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Server Side Include translator as PHP functions

2011-10-10 Thread Complex
Ah, well, thanks for the job advice, guys. I'll go looking elsewhere
for possible PHP solutions. Or, failing that, continue the build up to
actually being able to replace all of this with a company-wide (and
hopefully PHP-based) solution.

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Server Side Include translator as PHP functions

2011-10-09 Thread Tedd Sperling
On Oct 8, 2011, at 8:48 PM, Tommy Pham wrote:
On Sat, Oct 8, 2011 at 5:33 PM, Complex complex.confus...@gmail.com wrote:
 
 Thanks for the advice, I'm aware of all that, but I'm looking for a
 specific PHP solution at the moment. Unless you have advice on how I
 can update the SSI includes on the larger website *without* having to
 also update the PHP includes for this smaller website?
 
 I take it that you don't know of such a function; do you have a
 recommendation for a good function or program repository I could
 search? The couple that I was looking at (such as
 http://php.resourceindex.com/) don't look like they've received a
 whole lot of attention lately, and may not be the best sources.
 
 
 Did you look at my suggestion as work around such as replacing the SSI
 mechanism for a particular path/URL with PHP?  Use of 'Conditional
 expressions' [1] maybe necessary which is beyond the scope of this list.
 
 What are SSI?
 
 SSI (Server Side Includes) are directives that are placed in HTML pages, and
 evaluated on the server while the pages are being served. They let you add
 dynamically generated content to an existing HTML page, without having to
 serve the entire page via a CGI program, or other dynamic technology.
 
 The decision of when to use SSI, and when to have your page entirely
 generated by some program, is usually a matter of how much of the page is
 static, and how much needs to be recalculated every time the page is served.
 SSI is a great way to add small pieces of information, such as the current
 time. But if a majority of your page is being generated at the time that it
 is served, you need to look for some other solution. [1]
 
 Last time I checked, SSI, either on httpd or IIS, doesn't have any means to
 do dynamically, including generating headers, as you intended.
 
 Regards,
 Tommy

My question is:

Why SSI?

I used SSI circa 1990's (before PHP) to include common code. However, it 
required me to also have .shtml suffixes on the files that used them. Since 
PHP, it's simple to use PHP include statements to accomplish the same thing.

So, I see no reason to use SSI's at all. What am I not understanding in this 
problem?

Cheers,

tedd


_
t...@sperling.com
http://sperling.com










--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Server Side Include translator as PHP functions

2011-10-09 Thread Complex
Tedd,

The crucial detail you're lookign for is my lack of choice or control
in the matter, for all sorts of reasons that are actually quite stupid
but not possible for *me* to change, and not possible for anyone else
to change quickly. Thus I am looking for a solution to the problem at
hand, instead of a suggestion for what the entire org should be doing
instead. I know what they should be doing instead, but that's not my
decision. It's not like I'm building a new website this way; I'm
trying to move forwards with an existing and large website. The more
different code-bases we have for different parts of the site, the
harder it will be to actually change to something else (PHP-based, I
pray).

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Server Side Include translator as PHP functions

2011-10-09 Thread Complex
On Sat, Oct 8, 2011 at 8:48 PM, Tommy Pham tommy...@gmail.com wrote:
 On Sat, Oct 8, 2011 at 5:33 PM, Complex complex.confus...@gmail.com wrote:

 Thanks for the advice, I'm aware of all that, but I'm looking for a
 specific PHP solution at the moment. Unless you have advice on how I
 can update the SSI includes on the larger website *without* having to
 also update the PHP includes for this smaller website?

 I take it that you don't know of such a function; do you have a
 recommendation for a good function or program repository I could
 search? The couple that I was looking at (such as
 http://php.resourceindex.com/) don't look like they've received a
 whole lot of attention lately, and may not be the best sources.

 Did you look at my suggestion as work around such as replacing the SSI
 mechanism for a particular path/URL with PHP?  Use of 'Conditional
 expressions' [1] maybe necessary which is beyond the scope of this list.

 What are SSI?

 SSI (Server Side Includes) are directives that are placed in HTML pages, and
 evaluated on the server while the pages are being served. They let you add
 dynamically generated content to an existing HTML page, without having to
 serve the entire page via a CGI program, or other dynamic technology.

 The decision of when to use SSI, and when to have your page entirely
 generated by some program, is usually a matter of how much of the page is
 static, and how much needs to be recalculated every time the page is served.
 SSI is a great way to add small pieces of information, such as the current
 time. But if a majority of your page is being generated at the time that it
 is served, you need to look for some other solution. [1]

 Last time I checked, SSI, either on httpd or IIS, doesn't have any means to
 do dynamically, including generating headers, as you intended.

 Regards,
 Tommy

 [1] http://httpd.apache.org/docs/current/howto/ssi.html


Tommy,

Yes, thanks, I did see that:
change  !--#include virtual=/includes/old/file/B.inc --
to !--#include virtual=/path/to/php/code2exec.php --

!--#include virtual=/path/to/php/code2exec.php --
does not work on our servers. (I hesitate to say that it doesn't work
anywhere; I don't have enough experience with that.)
What happened when I tried this is that the page displays the raw PHP
instead of the results of the PHP. The server executes the PHP first,
and then executes the SSI instructions, such that the following *does*
work.
?php include('/path/to/php/code2exec.php'); ?
(mind you, I've seen plenty of notes that you should/have to use
virtual() instead)



Regarding SSI not doing anything dynamic: Yes, that's mostly true. The
only dynamism you can get is using if/elsif/else statements while
checkign things like the current URL path, which are ridiculously
clunky.

So the point of this question was to find an *existing and tested*
non-module set of functions that I could employ to translate a
particular include into a set of PHP commands, and then use PHP to add
some dynamic content.

And do you see my main point here, please? I'd use PHP to add some
dynamic content WITHOUT CHANGING THE MAIN CODEBASE that is
unfortunately but definitely stuck in SSI.

I'll probably have to skip that idea, but I'll try to look elsewhere
for such a set of functions. I'd like to write them in the future, but
that's not going to happen within the next couple days. And if anyone
is still scraping their brow at the absolute HORROR  that we are using
SSI instead of the PHP that we should be using, please note that the
whole point of keeping the codebase the same everywhere is to move
everything into a new, modern codebase *real soon*.
-- 
-- CC ---

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Server Side Include translator as PHP functions

2011-10-09 Thread Tedd Sperling
On Oct 9, 2011, at 11:41 AM, Complex wrote:

 Tedd,
 
 The crucial detail you're lookign for is my lack of choice or control
 in the matter, for all sorts of reasons that are actually quite stupid
 but not possible for *me* to change, and not possible for anyone else
 to change quickly. Thus I am looking for a solution to the problem at
 hand, instead of a suggestion for what the entire org should be doing
 instead. I know what they should be doing instead, but that's not my
 decision. It's not like I'm building a new website this way; I'm
 trying to move forwards with an existing and large website. The more
 different code-bases we have for different parts of the site, the
 harder it will be to actually change to something else (PHP-based, I
 pray).
 
 -- 
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 

Without debating the question of choice, if I was confronted with a large web 
site that used SSI, I would inform the client of such and put together a bid as 
to my time to bring the site up to date. If not, then I think I would pass on 
working the site. In my experience, it's not worth my additional time to try to 
work around out of date technologies.

It is also been my experience that when I am confronted with something large 
scale, and when approved by the client, I simply do a site-wide find and 
replace (namely change !--#include to ?php include) and then evaluate all 
occurrences prior to changing. That usually gives me a good idea of the breath 
of the problem.

In addition, considering the !--#include has basically the same purpose as 
?php include, while it may be a wide-spread problem, I do not see it as a 
serious problem to address. Certainly, when including files that have a 
different suffix .shtml as compared to .php you will find that the Server 
will treat them differently but that's pretty easy to fix -- just change the 
files suffix or possibility write code in a .httacess file that would cause the 
interpreter to consider shtml files the same a php.

Of course, I may not fully understand the problem.

Good luck,

tedd

_
t...@sperling.com
http://sperling.com





--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Server Side Include translator as PHP functions

2011-10-09 Thread Tommy Pham
On Sun, Oct 9, 2011 at 8:41 AM, Complex complex.confus...@gmail.com wrote:

 Tedd,

 The crucial detail you're lookign for is my lack of choice or control
 in the matter, for all sorts of reasons that are actually quite stupid
 but not possible for *me* to change, and not possible for anyone else
 to change quickly. Thus I am looking for a solution to the problem at
 hand, instead of a suggestion for what the entire org should be doing
 instead. I know what they should be doing instead, but that's not my
 decision. It's not like I'm building a new website this way; I'm
 trying to move forwards with an existing and large website. The more
 different code-bases we have for different parts of the site, the
 harder it will be to actually change to something else (PHP-based, I
 pray).


At the time when I was working with ASP and SSI, I suggested my client to
better rewrite the application in OOP language then do patchworks.  But he
_insisted_ on keeping existing code base.  So I did patchworks here and
there.  It got to the point where he finally wanted some additional features
much later that it was impossible to do with ASP and SSI.  It was then that
he finally decided to go with my suggestions, which is months later.  During
that time, I could have easily rewritten the application in PHP.  That's why
I suggested you to consider the site's function and features.  It maybe just
one thing that the client/boss wants now, then another, and another...
etc...  Eventually, you're going to through the same thing I did.

Good luck,
Tommy


[PHP] Server Side Include translator as PHP functions

2011-10-08 Thread Complex
Hello,

Can you please tell me if there's already a set of PHP functions for
translating SSI commands to PHP?
I'm looking to do two things -- one difficult, one easy -- using PHP
on a hosted server.

My client has web pages that use Server Side Includes, and one
sub-site that uses PHP. The task is to make the PHP sub-site use the
same SSI includes as the rest of the site to maintain a consistent
code structure. I can simply use include_once() to include each SSI
include; that works fine. However, I'd like to recognize and replace
one of the SSI instructions with a more nuanced PHP instruction that
will insert dynamic information from the sub-site's environment.
 1. include SSI files A
 2. include SSI file B, Recognize B and replace it with some PHP code
 3. include SSI file C
and i can't actually do that b/c PHP gets run first and then SSI instructions.

So the difficult thing I want to do is to read the SSI files
(literally, using fread or similar), translate them to PHP ('include
virtual' -- include(), set var=foo value=bar -- var foo = bar,
etc), and then execute them.

Then the simple thing I want to do will be recognizing the commands I
want to replace or modify and doing so.

Since this is a hosted solution, I don't believe I can install any PHP
modules, and I'll have to use some functions instead. Does that
already exist, please?

-- 
-- CC ---

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Server Side Include translator as PHP functions

2011-10-08 Thread Tommy Pham
On Sat, Oct 8, 2011 at 8:36 AM, Complex complex.confus...@gmail.com wrote:

 Hello,

 Can you please tell me if there's already a set of PHP functions for
 translating SSI commands to PHP?
 I'm looking to do two things -- one difficult, one easy -- using PHP
 on a hosted server.

 My client has web pages that use Server Side Includes, and one
 sub-site that uses PHP. The task is to make the PHP sub-site use the
 same SSI includes as the rest of the site to maintain a consistent
 code structure. I can simply use include_once() to include each SSI
 include; that works fine. However, I'd like to recognize and replace
 one of the SSI instructions with a more nuanced PHP instruction that
 will insert dynamic information from the sub-site's environment.
  1. include SSI files A
  2. include SSI file B, Recognize B and replace it with some PHP code
  3. include SSI file C
 and i can't actually do that b/c PHP gets run first and then SSI
 instructions.

 So the difficult thing I want to do is to read the SSI files
 (literally, using fread or similar), translate them to PHP ('include
 virtual' -- include(), set var=foo value=bar -- var foo = bar,
 etc), and then execute them.

 Then the simple thing I want to do will be recognizing the commands I
 want to replace or modify and doing so.

 Since this is a hosted solution, I don't believe I can install any PHP
 modules, and I'll have to use some functions instead. Does that
 already exist, please?

 --
 -- CC ---


I think you didn't provide enough details to get a more accurate suggestion
of a solution, but here goes...  Is 'include SSI file B' always included and
always need to be replaced?  If so, that's a very apparent solution.  If
not, what are criterias?  URL? Query parameter(s) and/or value(s)?  Certain
user(s)?  Certain group(s) of users?  Certain hour of the day?  Certain user
agent(s)? etc...  Regardless of how dynamic any site is, there's a always
some kind of pattern.  What you need to do is identify that pattern and do
what you need accordingly.  What about having PHP read those files to be
included and output without having to rely on SSI mechanisms?

I'm just curious... since PHP is OOP and, IIRC of SSI, the use of SSI limits
the full potential of OOP and PHP.  Is the control of the application and
configurations beyond yours?

Regards,
Tommy


Re: [PHP] Server Side Include translator as PHP functions

2011-10-08 Thread Tommy Pham
On Sat, Oct 8, 2011 at 8:36 AM, Complex complex.confus...@gmail.com wrote:

 Hello,

 Can you please tell me if there's already a set of PHP functions for
 translating SSI commands to PHP?
 I'm looking to do two things -- one difficult, one easy -- using PHP
 on a hosted server.

 My client has web pages that use Server Side Includes, and one
 sub-site that uses PHP. The task is to make the PHP sub-site use the
 same SSI includes as the rest of the site to maintain a consistent
 code structure. I can simply use include_once() to include each SSI
 include; that works fine. However, I'd like to recognize and replace
 one of the SSI instructions with a more nuanced PHP instruction that
 will insert dynamic information from the sub-site's environment.
  1. include SSI files A
  2. include SSI file B, Recognize B and replace it with some PHP code
  3. include SSI file C
 and i can't actually do that b/c PHP gets run first and then SSI
 instructions.

 So the difficult thing I want to do is to read the SSI files
 (literally, using fread or similar), translate them to PHP ('include
 virtual' -- include(), set var=foo value=bar -- var foo = bar,
 etc), and then execute them.

 Then the simple thing I want to do will be recognizing the commands I
 want to replace or modify and doing so.

 Since this is a hosted solution, I don't believe I can install any PHP
 modules, and I'll have to use some functions instead. Does that
 already exist, please?

 --
 -- CC ---


I think you didn't provide enough details to get a more accurate suggestion
of a solution, but here goes...  Is 'include SSI file B' always included and
always need to be replaced?  If so, that's a very apparent solution.  If
not, what are criterias?  URL? Query parameter(s) and/or value(s)?  Certain
user(s)?  Certain group(s) of users?  Certain hour of the day?  Certain user
agent(s)? etc...  Regardless of how dynamic any site is, there's a always
some kind of pattern.  What you need to do is identify that pattern and do
what you need accordingly.  What about having PHP read those files to be
included and output without having to rely on SSI mechanisms?

I'm just curious... since PHP is OOP and, IIRC of SSI, the use of SSI limits
the full potential of OOP and PHP.  Is the control of the application and
configurations beyond yours?

Regards,
Tommy


Re: [PHP] Server Side Include translator as PHP functions

2011-10-08 Thread Tommy Pham
My apologies I was multitasking some heavy applications/tests and had a
huge spike in CPUs utilization and I accidentally clicked on send x2.


Re: [PHP] Server Side Include translator as PHP functions

2011-10-08 Thread Complex
On Sat, Oct 8, 2011 at 1:09 PM, Tommy Pham tommy...@gmail.com wrote:

 I think you didn't provide enough details to get a more accurate suggestion
 of a solution, but here goes...  Is 'include SSI file B' always included and
 always need to be replaced?  If so, that's a very apparent solution.  If
 not, what are criterias?  URL? Query parameter(s) and/or value(s)?  Certain
 user(s)?  Certain group(s) of users?  Certain hour of the day?  Certain user
 agent(s)? etc...  Regardless of how dynamic any site is, there's a always
 some kind of pattern.  What you need to do is identify that pattern and do
 what you need accordingly.  What about having PHP read those files to be
 included and output without having to rely on SSI mechanisms?

 I'm just curious... since PHP is OOP and, IIRC of SSI, the use of SSI limits
 the full potential of OOP and PHP.  Is the control of the application and
 configurations beyond yours?

 Regards,
 Tommy


Tommy,
Last question first: yes, using SSI limits the full potential of the
PHP being used, but the point of this exercise is to continue using
the existing SSI includes for this small subsection of the larger
website, and to not recode the larger whole to benefit the smaller
piece. Make whatever Star Trekism of that  you will; we simply don't
have time or resources to use PHP everywhere as we should.

I do not understand your question about criteria; the only criteria
for these Apache Server Side Includes is the relative (or
relative-to-root) filepath:
   !--#include virtual=/includes/header-pieces/A.inc --
If you mean, which server variables am I accessing with SSI and now
need to access with PHP, I'm primarily concerned with the current
filepath.

SSI include file B is, in this case, the contents of an HTML
webpage's HEAD block. The PHP-based CMS can fill the HEAD with some
useful info unique to the current page. If I can achieve the _actual
problem_ of translating the SSI commands into PHP, it would be a
simple matter for me to insert some additional material into the
middle of the original. The only reason I even mention this simple
problem is because it explains why Im bothering to do this at all. If
all I wanted was to get the unaltered output of the SSI includes, I'd
just continue doing ?php include(/includes/header-pieces/A.inc); ?
and be on my way.

All I want to know is if someone has already written a set of
functions to translate some if not all SSI commands into PHP.
 e.g.!--#include virtual=/includes/header-pieces/A.inc --
  becomes ?php include(/includes/header-pieces/A.inc); ?
   !--#set var=foo value=bar -- becomes ?php var
foo = bar; ?
   !--#if expr=${foo} --...!--#elif expr=${bar}
--...!--#else --...!--#endif --
   ?php if($foo) {...} elseif($bar) {...} else {...} ?
Otherwise, I have to write those functions myself and, inevitably,
spend time I don't have getting it right. I've searched, but I may
easily have missed or not recognized the functions that I need.


-- 
-- CC ---

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Server Side Include translator as PHP functions

2011-10-08 Thread Tommy Pham
On Sat, Oct 8, 2011 at 2:31 PM, Complex complex.confus...@gmail.com wrote:

 On Sat, Oct 8, 2011 at 1:09 PM, Tommy Pham tommy...@gmail.com wrote:

  I think you didn't provide enough details to get a more accurate
 suggestion
  of a solution, but here goes...  Is 'include SSI file B' always included
 and
  always need to be replaced?  If so, that's a very apparent solution.  If
  not, what are criterias?  URL? Query parameter(s) and/or value(s)?
 Certain
  user(s)?  Certain group(s) of users?  Certain hour of the day?  Certain
 user
  agent(s)? etc...  Regardless of how dynamic any site is, there's a always
  some kind of pattern.  What you need to do is identify that pattern and
 do
  what you need accordingly.  What about having PHP read those files to be
  included and output without having to rely on SSI mechanisms?
 
  I'm just curious... since PHP is OOP and, IIRC of SSI, the use of SSI
 limits
  the full potential of OOP and PHP.  Is the control of the application and
  configurations beyond yours?
 
  Regards,
  Tommy
 

 Tommy,
 Last question first: yes, using SSI limits the full potential of the
 PHP being used, but the point of this exercise is to continue using
 the existing SSI includes for this small subsection of the larger
 website, and to not recode the larger whole to benefit the smaller
 piece. Make whatever Star Trekism of that  you will; we simply don't
 have time or resources to use PHP everywhere as we should.


Then you should seriously consider the site's function and features and see
if the current application fits that model.  Doing little patchwork here and
there may end up costing a lot more time and resources than just rewriting
the application in PHP, IMO, not to mention losing customer/clients because
of buggy application due to patchworks.  I'm sure some experienced folks
here have been through that at some point, myself included - which is why I
stop using ASP and SSI and moved on to OOP over 10 years ago.

I do not understand your question about criteria; the only criteria
 for these Apache Server Side Includes is the relative (or
 relative-to-root) filepath:
   !--#include virtual=/includes/header-pieces/A.inc --
 If you mean, which server variables am I accessing with SSI and now
 need to access with PHP, I'm primarily concerned with the current
 filepath.

 SSI include file B is, in this case, the contents of an HTML
 webpage's HEAD block. The PHP-based CMS can fill the HEAD with some
 useful info unique to the current page. If I can achieve the _actual
 problem_ of translating the SSI commands into PHP, it would be a
 simple matter for me to insert some additional material into the
 middle of the original. The only reason I even mention this simple
 problem is because it explains why Im bothering to do this at all. If
 all I wanted was to get the unaltered output of the SSI includes, I'd
 just continue doing ?php include(/includes/header-pieces/A.inc); ?
 and be on my way.

 All I want to know is if someone has already written a set of
 functions to translate some if not all SSI commands into PHP.
 e.g.!--#include virtual=/includes/header-pieces/A.inc --
  becomes ?php include(/includes/header-pieces/A.inc); ?
   !--#set var=foo value=bar -- becomes ?php var
 foo = bar; ?
   !--#if expr=${foo} --...!--#elif expr=${bar}
 --...!--#else --...!--#endif --
   ?php if($foo) {...} elseif($bar) {...} else {...} ?
 Otherwise, I have to write those functions myself and, inevitably,
 spend time I don't have getting it right. I've searched, but I may
 easily have missed or not recognized the functions that I need.


 --
 -- CC ---


* Case 1 of always include and always replace (and not modifying headers):

change  !--#include virtual=/includes/old/file/B.inc --
to !--#include virtual=/path/to/php/code2exec.php --

* Anything else, if I'm reading it correctly:

Incoming request - static HTML file - SSI mechanism (included some files)

change the above flow to (there by passing SSI mechanism)

Incoming request - PHP file index.php (include some files, execute PHP
scripts as needed and change the httpd configurations accordingly)

or

Incoming request - SSI mechanism (included some files)

change the above flow to (there by passing SSI mechanism)

!--#include virtual=/path/to/php/file/handlingRequests.php -- or just
remove the SSI mechanism altogether and have a index.php file doing all the
work and thus reducing the complex configuration and application flow, and
server overhead.  (Migrating the SSI configurations in httpd to PHP codes
shouldn't take that long unless you're new to PHP.)

--- the file handlingRequests.php or index.php would look something akin to
below.

?php
include_once('/path/to/header.inc');
// psuedo code
// if condition A (looking to match certain query parameter name  value [1]
//or certain user agents [2]) then
//include ('/path/to/file/conditionA.inc');
// elseif condition B (whatever else condition 

Re: [PHP] Server Side Include translator as PHP functions

2011-10-08 Thread Complex
Thanks for the advice, I'm aware of all that, but I'm looking for a
specific PHP solution at the moment. Unless you have advice on how I
can update the SSI includes on the larger website *without* having to
also update the PHP includes for this smaller website?

I take it that you don't know of such a function; do you have a
recommendation for a good function or program repository I could
search? The couple that I was looking at (such as
http://php.resourceindex.com/) don't look like they've received a
whole lot of attention lately, and may not be the best sources.

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Server Side Include translator as PHP functions

2011-10-08 Thread Complex
Oh, and on our servers you can't call PHP commands from SSI includes.
I'm not certain if that's true from all servers, but it's certainly
the case that on some servers the PHP runs first and then the server
side commands. So  !--#include virtual=/path/to/php/code2exec.php
-- doesn't work. Gods I wish it did, then I'd simply have rewritten
the structural parts of my site in PHP years ago, and been able to use
that from my many legacy SHTML files.

And thanks for going to all that trouble, Tommy, but I'm looking for
existing functions -- to avoid trying to use something just written
and then debugging.

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Server Side Include translator as PHP functions

2011-10-08 Thread Tommy Pham
On Sat, Oct 8, 2011 at 5:33 PM, Complex complex.confus...@gmail.com wrote:

 Thanks for the advice, I'm aware of all that, but I'm looking for a
 specific PHP solution at the moment. Unless you have advice on how I
 can update the SSI includes on the larger website *without* having to
 also update the PHP includes for this smaller website?

 I take it that you don't know of such a function; do you have a
 recommendation for a good function or program repository I could
 search? The couple that I was looking at (such as
 http://php.resourceindex.com/) don't look like they've received a
 whole lot of attention lately, and may not be the best sources.


Did you look at my suggestion as work around such as replacing the SSI
mechanism for a particular path/URL with PHP?  Use of 'Conditional
expressions' [1] maybe necessary which is beyond the scope of this list.

What are SSI?

SSI (Server Side Includes) are directives that are placed in HTML pages, and
evaluated on the server while the pages are being served. They let you add
dynamically generated content to an existing HTML page, without having to
serve the entire page via a CGI program, or other dynamic technology.

The decision of when to use SSI, and when to have your page entirely
generated by some program, is usually a matter of how much of the page is
static, and how much needs to be recalculated every time the page is served.
SSI is a great way to add small pieces of information, such as the current
time. But if a majority of your page is being generated at the time that it
is served, you need to look for some other solution. [1]

Last time I checked, SSI, either on httpd or IIS, doesn't have any means to
do dynamically, including generating headers, as you intended.

Regards,
Tommy

[1] http://httpd.apache.org/docs/current/howto/ssi.html


Re: [PHP] Functions/methods aliases in PHp 5.2

2011-05-16 Thread David Harkness
On Sun, May 15, 2011 at 3:15 PM, Richard Quadling rquadl...@gmail.comwrote:

 Personally, I would recommend using 1 naming convention and sticking with
 it.


I wholeheartedly agree. Multiple method names is not flexibility--it's
confusion and an open invitation for bugs. Plus, even with two styles you'll
never satisfy everyone. For example I would expect getNumRows() or
getRowCount().

David


[PHP] Functions/methods aliases in PHp 5.2

2011-05-15 Thread Andre Polykanine
Hi everyone,

Is there any possibility to make a method or function alias in PHP?
Yes, I know I can do the following:

?php
function foo_bar($x) {
// And so we code...
return $result;
}

function FooBar($x) {
return foo_bar($x);
}

But maybe there is a more elegant solution?
Thanks!

-- 
With best regards from Ukraine,
Andre
Skype: Francophile
Twitter: http://twitter.com/m_elensule
Facebook: http://facebook.com/menelion


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Functions/methods aliases in PHp 5.2

2011-05-15 Thread Richard Quadling
On 15 May 2011 21:45, Andre Polykanine an...@oire.org wrote:
 Hi everyone,

 Is there any possibility to make a method or function alias in PHP?
 Yes, I know I can do the following:

 ?php
 function foo_bar($x) {
 // And so we code...
 return $result;
 }

 function FooBar($x) {
 return foo_bar($x)
 }

 But maybe there is a more elegant solution?
 Thanks!

Whilst you can do class_alias() - something I use to hide the long
class name for soap services - there isn't a function alias.

But, if you are creating your own functions, then you could use a
closure and that can be assigned to a variable ...

$fn_FooBar = function() { ... };

$fn_FooBar($a, $b, $c);

or

someFunc($fn_FooBar) { ... }


Closures are ideal for callbacks.

Why do you want to alias functions? Is it to obscure the existing name?

If so, take a look at using an encoder. This uses the compiled code
rather than the source to run.

It is faster to run as there is no compile phase and the code isn't
very easy to reverse.

-- 
Richard Quadling
Twitter : EE : Zend
@RQuadling : e-e.com/M_248814.html : bit.ly/9O8vFY

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Functions/methods aliases in PHp 5.2

2011-05-15 Thread Andre Polykanine
Hello Richard,

  I'd  like  to  make  a database wrapping class (yet another one,
aha!) as flexible, as possible.
So I'd like to make possible to call, for example,
$db-num_rows($result)
 and
$db-NumRows($result)
And was just wondering :-).

-- 
With best regards from Ukraine,
Andre
Skype: Francophile
My blog: http://oire.org/menelion (mostly in Russian)
Twitter: http://twitter.com/m_elensule
Facebook: http://facebook.com/menelion

 Original message 
From: Richard Quadling rquadl...@gmail.com
To: Andre Polykanine
Date created: , 12:48:30 AM
Subject: [PHP] Functions/methods aliases in PHp 5.2


  On 15 May 2011 21:45, Andre Polykanine an...@oire.org wrote:
 Hi everyone,

 Is there any possibility to make a method or function alias in PHP?
 Yes, I know I can do the following:

 ?php
 function foo_bar($x) {
 // And so we code...
 return $result;
 }

 function FooBar($x) {
 return foo_bar($x)
 }

 But maybe there is a more elegant solution?
 Thanks!

Whilst you can do class_alias() - something I use to hide the long
class name for soap services - there isn't a function alias.

But, if you are creating your own functions, then you could use a
closure and that can be assigned to a variable ...

$fn_FooBar = function() { ... };

$fn_FooBar($a, $b, $c);

or

someFunc($fn_FooBar) { ... }


Closures are ideal for callbacks.

Why do you want to alias functions? Is it to obscure the existing name?

If so, take a look at using an encoder. This uses the compiled code
rather than the source to run.

It is faster to run as there is no compile phase and the code isn't
very easy to reverse.

-- 
Richard Quadling
Twitter : EE : Zend
@RQuadling : e-e.com/M_248814.html : bit.ly/9O8vFY

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Functions/methods aliases in PHp 5.2

2011-05-15 Thread Richard Quadling
On 15 May 2011 23:06, Andre Polykanine an...@oire.org wrote:
 Hello Richard,

      I'd  like  to  make  a database wrapping class (yet another one,
 aha!) as flexible, as possible.
 So I'd like to make possible to call, for example,
 $db-num_rows($result)
                     and
 $db-NumRows($result)
 And was just wondering :-).

 --
 With best regards from Ukraine,
 Andre
 Skype: Francophile
 My blog: http://oire.org/menelion (mostly in Russian)
 Twitter: http://twitter.com/m_elensule
 Facebook: http://facebook.com/menelion

  Original message 
 From: Richard Quadling rquadl...@gmail.com
 To: Andre Polykanine
 Date created: , 12:48:30 AM
 Subject: [PHP] Functions/methods aliases in PHp 5.2


      On 15 May 2011 21:45, Andre Polykanine an...@oire.org wrote:
 Hi everyone,

 Is there any possibility to make a method or function alias in PHP?
 Yes, I know I can do the following:

 ?php
 function foo_bar($x) {
 // And so we code...
 return $result;
 }

 function FooBar($x) {
 return foo_bar($x)
 }

 But maybe there is a more elegant solution?
 Thanks!

 Whilst you can do class_alias() - something I use to hide the long
 class name for soap services - there isn't a function alias.

 But, if you are creating your own functions, then you could use a
 closure and that can be assigned to a variable ...

 $fn_FooBar = function() { ... };

 $fn_FooBar($a, $b, $c);

 or

 someFunc($fn_FooBar) { ... }


 Closures are ideal for callbacks.

 Why do you want to alias functions? Is it to obscure the existing name?

 If so, take a look at using an encoder. This uses the compiled code
 rather than the source to run.

 It is faster to run as there is no compile phase and the code isn't
 very easy to reverse.

A couple of things come to mind.

1 - If you create a subclass and were overriding num_rows(), the
subclass would have to also override NumRows(). Twice as much work.

2 - You could use __call() and __callStatic() magic methods, but you'd
have limited options for documentation then (assuming you use
docblocks.

Personally, I would recommend using 1 naming convention and sticking with it.

Richard.

-- 
Richard Quadling
Twitter : EE : Zend
@RQuadling : e-e.com/M_248814.html : bit.ly/9O8vFY

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] File locking with PHP functions

2011-04-04 Thread Paul M Foster
I'd like to know (from someone who knows the internals more than I do)
whether the following functions lock files and to what extent:

fopen($filename, 'w');

Does this function lock the file from writes until fclose()?
Does it lock from reads as well?

fopen($filename, 'r+');

Does this function lock the file from writes until fclose()?
Does it lock the file from reads as well?

file($filename);

Does this function lock the file from writes until finished?
Does it lock the file from reads as well?

All this is in the context of a Linux/Unix web server.

Paul

-- 
Paul M. Foster
http://noferblatz.com
http://quillandmouse.com

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] File locking with PHP functions

2011-04-04 Thread Stuart Dallas
On Monday, 4 April 2011 at 15:28, Paul M Foster wrote:
I'd like to know (from someone who knows the internals more than I do)
 whether the following functions lock files and to what extent:
 
 fopen($filename, 'w');
 
 Does this function lock the file from writes until fclose()?
 Does it lock from reads as well?
 
 fopen($filename, 'r+');
 
 Does this function lock the file from writes until fclose()?
 Does it lock the file from reads as well?
 
 file($filename);
 
 Does this function lock the file from writes until finished?
 Does it lock the file from reads as well?
 
 All this is in the context of a Linux/Unix web server.

No, fopen does not lock the file. Check out http://php.net/flock but be sure to 
read all of that page because there are some gotchas with using it.

-Stuart

-- 
Stuart Dallas
3ft9 Ltd
http://3ft9.com/





-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] File locking with PHP functions

2011-04-04 Thread Louis Huppenbauer
It may not be a direct answer to your question, but...
You could just use flock() to lock the file while accessing it.

louis

2011/4/4 Paul M Foster pa...@quillandmouse.com:
 I'd like to know (from someone who knows the internals more than I do)
 whether the following functions lock files and to what extent:

 fopen($filename, 'w');

 Does this function lock the file from writes until fclose()?
 Does it lock from reads as well?

 fopen($filename, 'r+');

 Does this function lock the file from writes until fclose()?
 Does it lock the file from reads as well?

 file($filename);

 Does this function lock the file from writes until finished?
 Does it lock the file from reads as well?

 All this is in the context of a Linux/Unix web server.

 Paul

 --
 Paul M. Foster
 http://noferblatz.com
 http://quillandmouse.com

 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] functions and global variables

2010-07-19 Thread Shreyas Agasthya
My two cents on this one.

Modify the $name within the function and print it.

Modify the$name outside the function (means the non-global-declared $name)
and print it. You will know the difference.

--Shreyas

On Mon, Jul 19, 2010 at 7:41 AM, Paul M Foster pa...@quillandmouse.comwrote:

 On Sun, Jul 18, 2010 at 06:37:30PM -0400, David Mehler wrote:

  Hello,
  I've got a file with a variable declared in it. For purposes of this
 post:
 
  $name = $_POST['name'];
 
  Now a little later in the same file I have a custom function call that
  outputs some information. In that information is an echo statement
  outputting $name:
 
  echo $name;
 
  I'm wondering do I have to have $name declared as a global variable
  within that function? For example:
 
  function customFunction() {
  global $name
  }
 
  I've tried it both ways and both ways it works, with and without the
  global statement. I was under the impression that to be useful in a
  function variables outside were not accessible.
  Thanks.
  Dave.

 Variables declared outside a function are visible outside the function.
 Variables declared inside a function are visible only within that
 function. To use a global variable inside a function, you must declare
 it global, as:

 global $globalvar;

 Paul

 --
 Paul M. Foster

 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php




-- 
Regards,
Shreyas Agasthya


Re: [PHP] functions and global variables

2010-07-19 Thread Simcha Younger




On Mon, 19 Jul 2010 13:37:12 +0530
Shreyas Agasthya shreya...@gmail.com wrote:

 My two cents on this one.
 
 Modify the $name within the function and print it.
 
 Modify the$name outside the function (means the non-global-declared $name)
 and print it. You will know the difference.
 
 --Shreyas
 
 On Mon, Jul 19, 2010 at 7:41 AM, Paul M Foster pa...@quillandmouse.comwrote:
 
  On Sun, Jul 18, 2010 at 06:37:30PM -0400, David Mehler wrote:
 
   Hello,
   I've got a file with a variable declared in it. For purposes of this
  post:
  
   $name = $_POST['name'];

  
   I'm wondering do I have to have $name declared as a global variable
   within that function? For example:
  
   function customFunction() {
   global $name
   }
  
   I've tried it both ways and both ways it works, with and without the
   global statement. I was under the impression that to be useful in a
   function variables outside were not accessible.
   Thanks.
   Dave.



It sounds like 'register globals' is turned on in your php.ini, and therefore 
$name will be visible everywhere, since it is taken from $_POST['name'].

-- 
Simcha Younger sim...@syounger.com

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] functions and global variables

2010-07-18 Thread David Mehler
Hello,
I've got a file with a variable declared in it. For purposes of this post:

$name = $_POST['name'];

Now a little later in the same file I have a custom function call that
outputs some information. In that information is an echo statement
outputting $name:

echo $name;

I'm wondering do I have to have $name declared as a global variable
within that function? For example:

function customFunction() {
global $name
}

I've tried it both ways and both ways it works, with and without the
global statement. I was under the impression that to be useful in a
function variables outside were not accessible.
Thanks.
Dave.

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] functions and global variables

2010-07-18 Thread Paul M Foster
On Sun, Jul 18, 2010 at 06:37:30PM -0400, David Mehler wrote:

 Hello,
 I've got a file with a variable declared in it. For purposes of this post:
 
 $name = $_POST['name'];
 
 Now a little later in the same file I have a custom function call that
 outputs some information. In that information is an echo statement
 outputting $name:
 
 echo $name;
 
 I'm wondering do I have to have $name declared as a global variable
 within that function? For example:
 
 function customFunction() {
 global $name
 }
 
 I've tried it both ways and both ways it works, with and without the
 global statement. I was under the impression that to be useful in a
 function variables outside were not accessible.
 Thanks.
 Dave.

Variables declared outside a function are visible outside the function.
Variables declared inside a function are visible only within that
function. To use a global variable inside a function, you must declare
it global, as:

global $globalvar;

Paul

-- 
Paul M. Foster

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] underscore in php functions?

2009-08-03 Thread Oral Timocin
Hi all,

i am a newbie to php an want to learn it. Aftere reading some sample Code 
an the documetation i have an unanswered question! 

for example:

public function _example(){
}

what does the _ mean in that function. Could anyone help me?

regards

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] underscore in php functions?

2009-08-03 Thread Stuart
2009/8/3 Oral Timocin o_timo...@gmx.de:
 Hi all,

 i am a newbie to php an want to learn it. Aftere reading some sample Code
 an the documetation i have an unanswered question!

 for example:

 public function _example(){
 }

 what does the _ mean in that function. Could anyone help me?

Absolutely. But some developers use it as a convention for private
methods or some other indicator.

-Stuart

-- 
http://stut.net/

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] underscore in php functions?

2009-08-03 Thread Oral Timocin
Stuart wrote:

 2009/8/3 Oral Timocin o_timo...@gmx.de:
 Hi all,

 i am a newbie to php an want to learn it. Aftere reading some sample Code
 an the documetation i have an unanswered question!

 for example:

 public function _example(){
 }

 what does the _ mean in that function. Could anyone help me?
 
 Absolutely. But some developers use it as a convention for private
 methods or some other indicator.
 
 -Stuart
 

Thank you for the answer. I have looked for the sample code again and you 
are right. Some of the marked funtions are protected and some are private. 
Now i have understand that. Thank you again.

regards

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] underscore in php functions?

2009-08-03 Thread Ashley Sheridan
On Mon, 2009-08-03 at 22:46 +0200, Oral Timocin wrote:
 Stuart wrote:
 
  2009/8/3 Oral Timocin o_timo...@gmx.de:
  Hi all,
 
  i am a newbie to php an want to learn it. Aftere reading some sample Code
  an the documetation i have an unanswered question!
 
  for example:
 
  public function _example(){
  }
 
  what does the _ mean in that function. Could anyone help me?
  
  Absolutely. But some developers use it as a convention for private
  methods or some other indicator.
  
  -Stuart
  
 
 Thank you for the answer. I have looked for the sample code again and you 
 are right. Some of the marked funtions are protected and some are private. 
 Now i have understand that. Thank you again.
 
 regards
 

Also, there are some special cases, like the __construct() function,
which use a double underscore, and have a special meaning for classes.

Thanks,
Ash
http://www.ashleysheridan.co.uk


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Two very useful PHP functions

2009-05-01 Thread Darren
This was discussed for PHP6, but eventually decided not to have such a
function. Instead, we now have the following:$var = $_GET['var'] ?: 5;

Taken from http://www.corephp.co.uk/archives/19-Prepare-for-PHP-6.html

'you'd be able to do something like this: $foo = $_GET['foo'] ?: 42; (i.e.
if foo is true, $foo will equal 42).'


2009/5/1 Raymond Irving xwis...@yahoo.com


 Hi Colin and Daniel,

 Thanks for the feedback.

 I know that this functionality can be added to a framework or a stand alone
 function but I'm assuming that we would not get the same performance:

 Case 1
 ---
 $c = isset($a) ? $a : '';
 // total time = overhead  of isset() + overhead of ?:

 Case 2
 ---
 $c = myWrapper($a,$b)
 // total time = overhead of myWrapper() + overhead of isset() + overhead of
 ?:

 Case 3
 ---
 $c = ifset($a,$b)
 // total time = overhead of ifset()



 Best regards

 __
 Raymond Irving

 --- On Thu, 4/30/09, Daniel Brown danbr...@php.net wrote:

  From: Daniel Brown danbr...@php.net
  Subject: Re: [PHP] Two very useful PHP functions
  To: Raymond Irving xwis...@yahoo.com
  Cc: php-general@lists.php.net
  Date: Thursday, April 30, 2009, 11:37 AM
  On Wed, Apr 29, 2009 at 22:32,
  Raymond Irving xwis...@yahoo.com
  wrote:
  
   What do you think? Can they make it into 5.3?
 
  Not when doing the ternary operator that you
  even displayed
  yourself takes up less code and time than a core function
  would.  It's
  a good idea, but better handled on the frontend of
  things.  You may
  want to consider contributing that to a framework, which is
  where it
  would be more appropriate.
 
  --
  /Daniel P. Brown
  daniel.br...@parasane.net
  || danbr...@php.net
  http://www.parasane.net/ || http://www.pilotpig.net/
  50% Off All Shared Hosting Plans at PilotPig: Use Coupon
  DOW1
 

 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] Two very useful PHP functions

2009-05-01 Thread Andrew Ballard
On Fri, May 1, 2009 at 4:05 AM, Darren dar...@sirdaz.com wrote:
 This was discussed for PHP6, but eventually decided not to have such a
 function. Instead, we now have the following:    $var = $_GET['var'] ?: 5;

 Taken from http://www.corephp.co.uk/archives/19-Prepare-for-PHP-6.html

 'you'd be able to do something like this: $foo = $_GET['foo'] ?: 42; (i.e.
 if foo is true, $foo will equal 42).'



I don't like that syntax at all. You would have to scrutinize code
even more to determine whether a statement like this was intentional
or a botched ternary operator. I'm not sure there is a need for a
function like ifset/ifsetor, but I'd MUCH rather have a clear function
name that could easily be found in the manual than mangling the
ternary operator.

Andrew

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Re: Two very useful PHP functions

2009-04-30 Thread Colin Guthrie

'Twas brillig, and Raymond Irving at 30/04/09 03:32 did gyre and gimble:

Hello,

Every so often I have to be using the isset() function to check if a variable 
exists. It would be useful to have something like an ifset() function

Instead of doing this

$v = isset($input) ? $input : $default;

we can do this

$v = ifset($input,$default); 
// returns $input if it exists otherwise it will return $default


We could also do the same for the empty() function. So instead of doing this

$v = empty($input) ? $default : $input;

we can do this

$v = ifempty($input,$default);
// returns $input if it is not empty otherwise it will return $default

What do you think? Can they make it into 5.3?


To be honest, I don't see the compelling need for this.

I don't disagree that the functionality is nice, however I quite like 
the verbose versions as they are clearer to understand without knowing 
an API function.


Also, most of the cases that you would use these functions are with 
input from GET args and the like. Most frameworks provides wrappers for 
this with handy ways to get the defaults etc.


So overall, I can't see this becoming a core PHP feature.

Col

--

Colin Guthrie
gmane(at)colin.guthr.ie
http://colin.guthr.ie/

Day Job:
  Tribalogic Limited [http://www.tribalogic.net/]
Open Source:
  Mandriva Linux Contributor [http://www.mandriva.com/]
  PulseAudio Hacker [http://www.pulseaudio.org/]
  Trac Hacker [http://trac.edgewall.org/]


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Two very useful PHP functions

2009-04-30 Thread Daniel Brown
On Wed, Apr 29, 2009 at 22:32, Raymond Irving xwis...@yahoo.com wrote:

 What do you think? Can they make it into 5.3?

Not when doing the ternary operator that you even displayed
yourself takes up less code and time than a core function would.  It's
a good idea, but better handled on the frontend of things.  You may
want to consider contributing that to a framework, which is where it
would be more appropriate.

-- 
/Daniel P. Brown
daniel.br...@parasane.net || danbr...@php.net
http://www.parasane.net/ || http://www.pilotpig.net/
50% Off All Shared Hosting Plans at PilotPig: Use Coupon DOW1

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Two very useful PHP functions

2009-04-30 Thread Raymond Irving

Hi Colin and Daniel,

Thanks for the feedback.

I know that this functionality can be added to a framework or a stand alone 
function but I'm assuming that we would not get the same performance:

Case 1
---
$c = isset($a) ? $a : ''; 
// total time = overhead  of isset() + overhead of ?:

Case 2
---
$c = myWrapper($a,$b)  
// total time = overhead of myWrapper() + overhead of isset() + overhead of ?:

Case 3
---
$c = ifset($a,$b)  
// total time = overhead of ifset()



Best regards

__
Raymond Irving

--- On Thu, 4/30/09, Daniel Brown danbr...@php.net wrote:

 From: Daniel Brown danbr...@php.net
 Subject: Re: [PHP] Two very useful PHP functions
 To: Raymond Irving xwis...@yahoo.com
 Cc: php-general@lists.php.net
 Date: Thursday, April 30, 2009, 11:37 AM
 On Wed, Apr 29, 2009 at 22:32,
 Raymond Irving xwis...@yahoo.com
 wrote:
 
  What do you think? Can they make it into 5.3?
 
     Not when doing the ternary operator that you
 even displayed
 yourself takes up less code and time than a core function
 would.  It's
 a good idea, but better handled on the frontend of
 things.  You may
 want to consider contributing that to a framework, which is
 where it
 would be more appropriate.
 
 -- 
 /Daniel P. Brown
 daniel.br...@parasane.net
 || danbr...@php.net
 http://www.parasane.net/ || http://www.pilotpig.net/
 50% Off All Shared Hosting Plans at PilotPig: Use Coupon
 DOW1


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Two very useful PHP functions

2009-04-29 Thread Raymond Irving
Hello,

Every so often I have to be using the isset() function to check if a variable 
exists. It would be useful to have something like an ifset() function

Instead of doing this

$v = isset($input) ? $input : $default;

we can do this

$v = ifset($input,$default); 
// returns $input if it exists otherwise it will return $default

We could also do the same for the empty() function. So instead of doing this

$v = empty($input) ? $default : $input;

we can do this

$v = ifempty($input,$default);
// returns $input if it is not empty otherwise it will return $default

What do you think? Can they make it into 5.3?


Best regards
__
Raymond Irving



Re: [PHP] Common PHP functions benchmarks

2008-04-12 Thread Nathan Nobbe
On Tue, Apr 8, 2008 at 4:00 PM, Nathan Nobbe [EMAIL PROTECTED] wrote:

 i did some tests a couple of months ago; pitting array iteration vs.
 iteration w/ spl iterators.  link is down atm; but will be back soon and ill
 post again so you have something similar to look at.  a quick glance shows
 you have some thorough tests; but for the results some graphs would be nice
 :)  kinda hard to see 'the big picture' w/o them.


got the dev site back up.  heres the tests; let me know if they dont
resolve.

http://nathan.moxune.com/arrayVsArrayIteratorReport.php

-nathan


Re: [PHP] Common PHP functions benchmarks

2008-04-11 Thread Larry Garfield
I did some similar micro-benchmarking a while back, too:

http://www.garfieldtech.com/blog/magic-benchmarks

On Tuesday 08 April 2008, Jason Knight wrote:
 I've been running some benchmarks on popular PHP functions.  I would like
 to get some input on them from the community.  So far I have run tests on
 Arrays and PHP5's SPL ArrayObject, as well as loops and some networking
 functions.


 Here is a link to the code used for the benchmarks.
 http://www.synthable.com/benchmarks/

 Thanks,
 Jason http://www.synthable.com/


-- 
Larry Garfield  AIM: LOLG42
[EMAIL PROTECTED]   ICQ: 6817012

If nature has made any one thing less susceptible than all others of 
exclusive property, it is the action of the thinking power called an idea, 
which an individual may exclusively possess as long as he keeps it to 
himself; but the moment it is divulged, it forces itself into the possession 
of every one, and the receiver cannot dispossess himself of it.  -- Thomas 
Jefferson

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Re: Common PHP functions benchmarks

2008-04-10 Thread Jason Knight
Does nobody have any other input?

On Tue, Apr 8, 2008 at 12:52 PM, Jason Knight [EMAIL PROTECTED] wrote:

 I've been running some benchmarks on popular PHP functions.  I would like
 to get some input on them from the community.  So far I have run tests on
 Arrays and PHP5's SPL ArrayObject, as well as loops and some networking
 functions.


 Here is a link to the code used for the benchmarks.
 http://www.synthable.com/benchmarks/

 Thanks,
 Jason http://www.synthable.com/



[PHP] Common PHP functions benchmarks

2008-04-08 Thread Jason Knight
I've been running some benchmarks on popular PHP functions.  I would like to
get some input on them from the community.  So far I have run tests on
Arrays and PHP5's SPL ArrayObject, as well as loops and some networking
functions.


Here is a link to the code used for the benchmarks.
http://www.synthable.com/benchmarks/

Thanks,
Jason http://www.synthable.com/


Re: [PHP] Common PHP functions benchmarks

2008-04-08 Thread Nathan Nobbe
On Tue, Apr 8, 2008 at 1:52 PM, Jason Knight [EMAIL PROTECTED] wrote:

 I've been running some benchmarks on popular PHP functions.  I would like
 to
 get some input on them from the community.  So far I have run tests on
 Arrays and PHP5's SPL ArrayObject, as well as loops and some networking
 functions.


 Here is a link to the code used for the benchmarks.
 http://www.synthable.com/benchmarks/


i did some tests a couple of months ago; pitting array iteration vs.
iteration w/ spl iterators.  link is down atm; but will be back soon and ill
post again so you have something similar to look at.  a quick glance shows
you have some thorough tests; but for the results some graphs would be nice
:)  kinda hard to see 'the big picture' w/o them.

-nathan


[PHP] Functions not available when run as Scheduled Task?

2008-02-27 Thread Brian Dunning
Don't laugh but we have a Win 2003 Server set up with WAMP, and the  
PHP/MySQL scripts work great. I set one up to run as a scheduled task:


C:\php5\php.exe D:\wamp\www\scriptname.php

...but nothing happens and the Scheduled Tasks log says that it exited  
with an (ff). So I entered the above manually into a command prompt,  
and it said that mysql_connect() is an unknown function! WTF? It's  
like it's trying to use a different php.ini file that maybe has mysql  
commented out. I double checked that all the php.ini files on the  
machine do have mysql enabled, and anyway mysql works fine normally.


Anyone know what PHP is doing to me here in the scheduled service?

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Functions not available when run as Scheduled Task?

2008-02-27 Thread Ray Hauge

Brian Dunning wrote:
Don't laugh but we have a Win 2003 Server set up with WAMP, and the 
PHP/MySQL scripts work great. I set one up to run as a scheduled task:


C:\php5\php.exe D:\wamp\www\scriptname.php

...but nothing happens and the Scheduled Tasks log says that it exited 
with an (ff). So I entered the above manually into a command prompt, and 
it said that mysql_connect() is an unknown function! WTF? It's like it's 
trying to use a different php.ini file that maybe has mysql commented 
out. I double checked that all the php.ini files on the machine do have 
mysql enabled, and anyway mysql works fine normally.


Anyone know what PHP is doing to me here in the scheduled service?



I think that there might be a separate php-cli.ini file that is not 
loading the modules that apache does.  I'm too lazy to verify, but I 
remember running into that myself a time or two.  Check the output of 
phpinfo(); or C:\php5\php.exe -v (I think that'll work on Windows).


--
Ray Hauge
www.primateapplications.com

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Functions not available when run as Scheduled Task?

2008-02-27 Thread Daniel Brown
On Wed, Feb 27, 2008 at 6:37 PM, Brian Dunning [EMAIL PROTECTED] wrote:
 Don't laugh but we have a Win 2003 Server set up with WAMP, and the
  PHP/MySQL scripts work great. I set one up to run as a scheduled task:

  C:\php5\php.exe D:\wamp\www\scriptname.php

  ...but nothing happens and the Scheduled Tasks log says that it exited
  with an (ff). So I entered the above manually into a command prompt,
  and it said that mysql_connect() is an unknown function! WTF? It's
  like it's trying to use a different php.ini file that maybe has mysql
  commented out. I double checked that all the php.ini files on the
  machine do have mysql enabled, and anyway mysql works fine normally.

Try doing this:

?
// D:\wamp\www\phpinfo.php
phpinfo();
?

Then run the command:

C:\php5\php.exe D:\wamp\www\phpinfo.php  D:\wamp\www\phpinfo.html

Then view phpinfo.html in a browser.  See how the php.ini and the
MySQL settings are set, and if need be, correct them.  Viewing
phpinfo.php in the browser may show different results.

-- 
/Dan

Daniel P. Brown
Senior Unix Geek
? while(1) { $me = $mind--; sleep(86400); } ?

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP] Functions not available when run as Scheduled Task?

2008-02-27 Thread Andrés Robinet
 -Original Message-
 From: Ray Hauge [mailto:[EMAIL PROTECTED]
 Sent: Wednesday, February 27, 2008 6:42 PM
 To: Brian Dunning
 Cc: php-general@lists.php.net
 Subject: Re: [PHP] Functions not available when run as Scheduled Task?
 
 Brian Dunning wrote:
  Don't laugh but we have a Win 2003 Server set up with WAMP, and the
  PHP/MySQL scripts work great. I set one up to run as a scheduled task:
 
  C:\php5\php.exe D:\wamp\www\scriptname.php
 
  ...but nothing happens and the Scheduled Tasks log says that it exited
  with an (ff). So I entered the above manually into a command prompt, and
  it said that mysql_connect() is an unknown function! WTF? It's like it's
  trying to use a different php.ini file that maybe has mysql commented
  out. I double checked that all the php.ini files on the machine do have
  mysql enabled, and anyway mysql works fine normally.
 
  Anyone know what PHP is doing to me here in the scheduled service?
 
 
 I think that there might be a separate php-cli.ini file that is not
 loading the modules that apache does.  I'm too lazy to verify, but I
 remember running into that myself a time or two.  Check the output of
 phpinfo(); or C:\php5\php.exe -v (I think that'll work on Windows).
 
 --
 Ray Hauge
 www.primateapplications.com
 
 --

Use the -c command line option to be sure, for example:

C:\php5\php.exe -c C:\php5\php.ini -f D:\wamp\www\scriptname.php

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Functions not available when run as Scheduled Task?

2008-02-27 Thread Jochem Maas

Brian Dunning schreef:
Don't laugh but we have a Win 2003 Server set up with WAMP, and the 
PHP/MySQL scripts work great. I set one up to run as a scheduled task:


C:\php5\php.exe D:\wamp\www\scriptname.php

...but nothing happens and the Scheduled Tasks log says that it exited 
with an (ff). So I entered the above manually into a command prompt, and 
it said that mysql_connect() is an unknown function! WTF? It's like it's 
trying to use a different php.ini file that maybe has mysql commented 
out. I double checked that all the php.ini files on the machine do have 
mysql enabled, and anyway mysql works fine normally.


Anyone know what PHP is doing to me here in the scheduled service?


AFAIK php on windows is generally built with all relevant modules included
(check the php.ini used by apaches mod_php and you'll probably notice the
extension=php_mysql.dll line is actually commented out)

my guess would be that the CLI version of php is built without the mysql
extension.

and if it's not that then it's probably down to difference in php.ini after all.





--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Functions not available when run as Scheduled Task?

2008-02-27 Thread Brian Dunning
Adding this command solved it. Thanks to everyone! I did not even know  
this command existed.



On Feb 27, 2008, at 3:46 PM, Andrés Robinet wrote:


Use the -c command line option to be sure, for example:


C:\php5\php.exe -c C:\php5\php.ini -f D:\wamp\www\scriptname.php

--


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Functions are driving me crazy....

2008-01-25 Thread Thijs Lensselink

Jason Pruim wrote:

Hi everyone :)

So partly to get an answer, and partly to boost my post rankings for 
the week I have a question.


I am attempting to write an authentication function which would query 
a database, check the username/password and return true if it matches. 
If it doesn't match, then it shouldn't return anything and they are 
denied access.


Here is the code for the function:

?PHP

function authentication(){
if($user  $pass) { // Keep in mind, PASSWORD has meaning in 
MySQL

// Do your string sanitizing here
// (e.g. - $user = mysql_real_escape_string($_POST['user']);)
$loginQuery = SELECT * FROM login WHERE user='.$user.' 
AND Userpass='.$pass.' LIMIT 0,1;;
$loginResult = mysql_query($loginQuery) or die(Wrong data 
supplied or database error  .mysql_error());

while($row1 = mysql_fetch_array($loginResult)) {
$_SESSION['user'] = $row1['User'];
$_SESSION['loggedin'] = YES;
$authenticated = true;
}
}
}return $authenticated;
?

Change:

}return $authenticated;

to

   return $authenticated;
}

else it will never return the value from the function. But it will 
always give you undefined variable notice


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Functions are driving me crazy....

2008-01-25 Thread Jim Lucas

Jason Pruim wrote:

Hi everyone :)

So partly to get an answer, and partly to boost my post rankings for the 
week I have a question.


I am attempting to write an authentication function which would query a 
database, check the username/password and return true if it matches. If 
it doesn't match, then it shouldn't return anything and they are denied 
access.


Here is the code for the function:

?PHP

function authentication(){

if($user  $pass) { // Keep in mind, PASSWORD has meaning in MySQL
// Do your string sanitizing here
// (e.g. - $user = mysql_real_escape_string($_POST['user']);)
$loginQuery = SELECT * FROM login WHERE user='.$user.' 
AND Userpass='.$pass.' LIMIT 0,1;;
$loginResult = mysql_query($loginQuery) or die(Wrong data 
supplied or database error  .mysql_error());

while($row1 = mysql_fetch_array($loginResult)) {
$_SESSION['user'] = $row1['User'];
$_SESSION['loggedin'] = YES;
$authenticated = true;
}
}
}return $authenticated;
?

and here is the code that I am using to call it:

$authenticated = authentication($user, $pass);

but when ever I try and run it I get the following errors in my log 
file, and the page doesn't load the info in the database.


Help me please!



My error log shows this:

[Fri Jan 25 14:55:14 2008] [error] PHP Notice:  Undefined variable: 
authenticated in 
/Volumes/RAIDer/webserver/includes/oldbinc/function/authentication.func.php 
on line 16
[Fri Jan 25 14:55:14 2008] [error] PHP Notice:  Undefined variable: user 
in 
/Volumes/RAIDer/webserver/includes/oldbinc/function/authentication.func.php 
on line 5
[Fri Jan 25 14:55:14 2008] [error] PHP Notice:  Undefined variable: user 
in 
/Volumes/RAIDer/webserver/includes/oldbinc/function/authentication.func.php 
on line 5


--

Jason Pruim
Raoset Inc.
Technology Manager
MQC Specialist
3251 132nd ave
Holland, MI, 49424
www.raoset.com
[EMAIL PROTECTED]





?PHP

function authentication(){
  // Per your example below, you need to call the escaping before your
  // if () statement

  // Do something like an if ( isset($_POST['user']) ) {..}
  $user = mysql_real_escape_string(@$_POST['user']);

  // Do something like an if ( isset($_POST['pass']) ) {..}
  $pass = mysql_real_escape_string(@$_POST['pass']);

  // Keep in mind, PASSWORD has meaning in MySQL
  if($user  $pass) {

// Do your string sanitizing here
// (e.g. - $user = mysql_real_escape_string($_POST['user']);)
$loginQuery = SELECT * FROM login WHERE user='.$user.' .
AND Userpass='.$pass.';
//  No need to end with a LIMIT clause

$loginResult = mysql_query($loginQuery) or
die(DB Error .mysql_error());

// I do an if () statement because you should only get one result
// back.  If you get more then one, then I think something is wrong
if ( mysql_num_row($loginResult)  0 ) {
  $row = mysql_fetch_assoc($loginResult);
  $_SESSION['user'] = $row1['User'];
  $_SESSION['loggedin'] = YES;
  $authenticated = true;
}
  }
  // Make sure your return is inside the closing bracket
  return $authenticated;
}
?



--
Jim Lucas

   Some men are born to greatness, some achieve greatness,
   and some have greatness thrust upon them.

Twelfth Night, Act II, Scene V
by William Shakespeare

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Functions are driving me crazy....

2008-01-25 Thread Nathan Nobbe
On Jan 25, 2008 3:35 PM, Thijs Lensselink [EMAIL PROTECTED] wrote:

 Change:

 }return $authenticated;

 to

return $authenticated;
 }

 else it will never return the value from the function. But it will
 always give you undefined variable notice


nice catch ;)

-nathan


Re: [PHP] Functions are driving me crazy....

2008-01-25 Thread Richard Lynch


On Fri, January 25, 2008 1:59 pm, Jason Pruim wrote:
 Hi everyone :)

 So partly to get an answer, and partly to boost my post rankings for
 the week I have a question.

 I am attempting to write an authentication function which would query
 a database, check the username/password and return true if it matches.
 If it doesn't match, then it shouldn't return anything and they are
 denied access.

 Here is the code for the function:

 ?PHP

   function authentication(){

//initialize the variable so it has SOMETHING in it before you try to
return it at the end:
$authenticated = false;

   if($user  $pass) { // Keep in mind, PASSWORD has meaning in 
 MySQL

You need to pass in $user and $pass as arguments at the function
authentication ($user, $pass)

   // Do your string sanitizing here
   // (e.g. - $user = 
 mysql_real_escape_string($_POST['user']);)
   $loginQuery = SELECT * FROM login WHERE 
 user='.$user.' AND
 Userpass='.$pass.' LIMIT 0,1;;
   $loginResult = mysql_query($loginQuery) or die(Wrong 
 data supplied
 or database error  .mysql_error());
   while($row1 = mysql_fetch_array($loginResult)) {
   $_SESSION['user'] = $row1['User'];
   $_SESSION['loggedin'] = YES;
   $authenticated = true;
   }
   }
   }return $authenticated;
 ?

 and here is the code that I am using to call it:

 $authenticated = authentication($user, $pass);

 but when ever I try and run it I get the following errors in my log
 file, and the page doesn't load the info in the database.

 Help me please!



 My error log shows this:

 [Fri Jan 25 14:55:14 2008] [error] PHP Notice:  Undefined variable:
 authenticated in /Volumes/RAIDer/webserver/includes/oldbinc/function/
 authentication.func.php on line 16
 [Fri Jan 25 14:55:14 2008] [error] PHP Notice:  Undefined variable:
 user in /Volumes/RAIDer/webserver/includes/oldbinc/function/
 authentication.func.php on line 5
 [Fri Jan 25 14:55:14 2008] [error] PHP Notice:  Undefined variable:
 user in /Volumes/RAIDer/webserver/includes/oldbinc/function/
 authentication.func.php on line 5

 --

 Jason Pruim
 Raoset Inc.
 Technology Manager
 MQC Specialist
 3251 132nd ave
 Holland, MI, 49424
 www.raoset.com
 [EMAIL PROTECTED]





-- 
Some people have a gift link here.
Know what I want?
I want you to buy a CD from some indie artist.
http://cdbaby.com/from/lynch
Yeah, I get a buck. So?

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Functions are driving me crazy....

2008-01-25 Thread Nathan Nobbe
?PHP
/// initialize the return variable
$authenticated = false;

   function authentication(){
   if(!isset($user) || !isset($pass)) { return false; }  /// --
i would do it a bit nicer than this, but you get the idea

   if($user  $pass) { // Keep in mind, PASSWORD has meaning in
MySQL
   // Do your string sanitizing here
   // (e.g. - $user = mysql_real_escape_string($
_POST['user']);)
   $loginQuery = SELECT * FROM login WHERE
user='.$user.' AND
Userpass='.$pass.' LIMIT 0,1;;
   $loginResult = mysql_query($loginQuery) or die(Wrong
data supplied
or database error  .mysql_error());
   while($row1 = mysql_fetch_array($loginResult)) {
   $_SESSION['user'] = $row1['User'];
   $_SESSION['loggedin'] = YES;
   $authenticated = true;
   }
   }
   }return $authenticated;
?

-nathan


Re: [PHP] Functions are driving me crazy....

2008-01-25 Thread Thijs Lensselink

Nathan Nobbe wrote:
On Jan 25, 2008 3:35 PM, Thijs Lensselink [EMAIL PROTECTED] 
mailto:[EMAIL PROTECTED] wrote:


Change:

}return $authenticated;

to

   return $authenticated;
}

else it will never return the value from the function. But it will
always give you undefined variable notice


nice catch ;)

-nathan


and that on a friday evening :)

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Functions are driving me crazy....

2008-01-25 Thread Jason Pruim

Hi everyone :)

So partly to get an answer, and partly to boost my post rankings for  
the week I have a question.


I am attempting to write an authentication function which would query  
a database, check the username/password and return true if it matches.  
If it doesn't match, then it shouldn't return anything and they are  
denied access.


Here is the code for the function:

?PHP

function authentication(){
if($user  $pass) { // Keep in mind, PASSWORD has meaning in 
MySQL
// Do your string sanitizing here
// (e.g. - $user = 
mysql_real_escape_string($_POST['user']);)
			$loginQuery = SELECT * FROM login WHERE user='.$user.' AND  
Userpass='.$pass.' LIMIT 0,1;;
			$loginResult = mysql_query($loginQuery) or die(Wrong data supplied  
or database error  .mysql_error());

while($row1 = mysql_fetch_array($loginResult)) {
$_SESSION['user'] = $row1['User'];
$_SESSION['loggedin'] = YES;
$authenticated = true;
}
}
}return $authenticated;
?

and here is the code that I am using to call it:

$authenticated = authentication($user, $pass);

but when ever I try and run it I get the following errors in my log  
file, and the page doesn't load the info in the database.


Help me please!



My error log shows this:

[Fri Jan 25 14:55:14 2008] [error] PHP Notice:  Undefined variable:  
authenticated in /Volumes/RAIDer/webserver/includes/oldbinc/function/ 
authentication.func.php on line 16
[Fri Jan 25 14:55:14 2008] [error] PHP Notice:  Undefined variable:  
user in /Volumes/RAIDer/webserver/includes/oldbinc/function/ 
authentication.func.php on line 5
[Fri Jan 25 14:55:14 2008] [error] PHP Notice:  Undefined variable:  
user in /Volumes/RAIDer/webserver/includes/oldbinc/function/ 
authentication.func.php on line 5


--

Jason Pruim
Raoset Inc.
Technology Manager
MQC Specialist
3251 132nd ave
Holland, MI, 49424
www.raoset.com
[EMAIL PROTECTED]




Re: [PHP] Functions are driving me crazy....

2008-01-25 Thread Nathan Nobbe
oh; i just noticed you dont have formal parameters for $user or $pass;
so,

function authentication($user, $pass) {
/// ... then you can remove the first line i put in there on the last post
:)
}

-nathan


[PHP] Functions with Static Variables vs. Classes

2007-11-29 Thread news_yodpeirs
For some simple applications I use a function to collect values in a static
variable and to return them when called in a special way, just like this
(fairly senseless) example:
  function example($elem='') {
static $store = array();
if (!func_num_args()) return($store);
... do something with $elem ...
$store[] = $elem;
  }
I would call this a singleton-micro-class, as it works like a class with
data and methods, but there is always only one of it, having only one
method.

Why do I? Because I dont need to worry about variablescope as if I would use
global variables and I dont have to initialize an object before the first
call (with the scope-problem again). I simply can call it everywhere and
everytime.

Do you have any comments to this approach?

Thomas

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Functions with Static Variables vs. Classes

2007-11-29 Thread Zoltán Németh
2007. 11. 29, csütörtök keltezéssel 14.18-kor [EMAIL PROTECTED]
ezt írta:
 For some simple applications I use a function to collect values in a static
 variable and to return them when called in a special way, just like this
 (fairly senseless) example:
   function example($elem='') {
 static $store = array();

AFAIK the above line should cause an error on the second run of the
function, as you declare the same static variable for the second time.

or am I wrong?

greets
Zoltán Németh

 if (!func_num_args()) return($store);
 ... do something with $elem ...
 $store[] = $elem;
   }
 I would call this a singleton-micro-class, as it works like a class with
 data and methods, but there is always only one of it, having only one
 method.
 
 Why do I? Because I dont need to worry about variablescope as if I would use
 global variables and I dont have to initialize an object before the first
 call (with the scope-problem again). I simply can call it everywhere and
 everytime.
 
 Do you have any comments to this approach?
 
 Thomas
 

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Functions with Static Variables vs. Classes

2007-11-29 Thread news_yodpeirs
From: Zoltán Németh [EMAIL PROTECTED]
   function example($elem='') {
 static $store = array();

 AFAIK the above line should cause an error on the second run of the
 function, as you declare the same static variable for the second time.

 or am I wrong?

I think so - otherwise static Variables would be quite senseless. The line
starting with static is (so do I think) once evaluated at compile-time or at
the first run and the ignored.

Thomas 

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Functions with Static Variables vs. Classes

2007-11-29 Thread Jochem Maas
[EMAIL PROTECTED] wrote:
 From: Zoltán Németh [EMAIL PROTECTED]
   function example($elem='') {
 static $store = array();
 AFAIK the above line should cause an error on the second run of the
 function, as you declare the same static variable for the second time.

 or am I wrong?

indeed you are :-)

 
 I think so - otherwise static Variables would be quite senseless. The line
 starting with static is (so do I think) once evaluated at compile-time or at
 the first run and the ignored.

I believe it's a compile time definition ... which is the reason you can only
initialize static vars with scalar values (and not the result of expressions or
resources or objects, etc)


 
 Thomas 
 

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] question regarding type hinting parameters of php functions

2007-11-26 Thread Dirk Thomas / 4wd media

Hi,

i have tried a current snapshot of PHP 5.3 and have a question regarding 
type hinting.


For example when using the function
array_slice(array $array, int $offset, int $length)
with a non-integer length parameter, what is the desired behavior?

When calling
  array_slice($array, 0, (float)2);
  the resulting array is EMPTY.
When using the right type
  array_slice($array, 0, (int)2);
  it works as expected.

Shouldn't there be a notice/warning than just a wrong return value?
In my case there is neither a warning nor does it work as expected.
(perhaps it do something wrong?)

Of course i can use int's, but in my opinion either a warning should be 
given or the function should gracefully handle the wrong typed parameter.


Thank you for any feedback,
Dirk

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] question regarding type hinting parameters of php functions

2007-11-26 Thread T . Lensselink
On Mon, 26 Nov 2007 10:29:40 +0100, Dirk Thomas / 4wd media
[EMAIL PROTECTED] wrote:
 Hi,
 
 i have tried a current snapshot of PHP 5.3 and have a question regarding
 type hinting.
 
 For example when using the function
 array_slice(array $array, int $offset, int $length)
 with a non-integer length parameter, what is the desired behavior?
 
 When calling
array_slice($array, 0, (float)2);
the resulting array is EMPTY.
 When using the right type
array_slice($array, 0, (int)2);
it works as expected.
 
 Shouldn't there be a notice/warning than just a wrong return value?
 In my case there is neither a warning nor does it work as expected.
 (perhaps it do something wrong?)
 
 Of course i can use int's, but in my opinion either a warning should be
 given or the function should gracefully handle the wrong typed parameter.
 
 Thank you for any feedback,
 Dirk
 

I think there should at least be a notice. It's propably better to ask this
on the internals list.

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] functions versus includes

2007-11-11 Thread Frank Lopes

I just started using PHP and got to think...

Without getting into the discussion of best practices, strictly from  a 
performance perspective,

what is faster: a function or an include?

For example I have a block of text that needs to appear mutliple times 
throughout the site.


Will I be better off creating a function with its contents and then later 
just calling the function or,
will it be faster (from an execution perspective) for me to create an .inc 
file that gets included later on?


Thanks for the your thoughts. 


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] functions versus includes

2007-11-11 Thread Chris

Frank Lopes wrote:

I just started using PHP and got to think...

Without getting into the discussion of best practices, strictly from  
a performance perspective,

what is faster: a function or an include?

For example I have a block of text that needs to appear mutliple times 
throughout the site.


Will I be better off creating a function with its contents and then 
later just calling the function or,
will it be faster (from an execution perspective) for me to create an 
.inc file that gets included later on?


Micro-optimization is pretty useless. I seriously doubt you would notice 
any difference in performance.


This comes under the other discussions like about which is faster - a 
foreach/while/for loop.


You'll find other bottlenecks (eg changing a regex to do an str_replace) 
which will make a bigger difference.


--
Postgresql  php tutorials
http://www.designmagick.com/

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] functions versus includes

2007-11-11 Thread Robert Cummings
On Mon, 2007-11-12 at 11:27 +1100, Chris wrote:
 Frank Lopes wrote:
  I just started using PHP and got to think...
  
  Without getting into the discussion of best practices, strictly from  
  a performance perspective,
  what is faster: a function or an include?
  
  For example I have a block of text that needs to appear mutliple times 
  throughout the site.
  
  Will I be better off creating a function with its contents and then 
  later just calling the function or,
  will it be faster (from an execution perspective) for me to create an 
  .inc file that gets included later on?
 
 Micro-optimization is pretty useless. I seriously doubt you would notice 
 any difference in performance.
 
 This comes under the other discussions like about which is faster - a 
 foreach/while/for loop.
 
 You'll find other bottlenecks (eg changing a regex to do an str_replace) 
 which will make a bigger difference.

Actually, if you're going to use a comparison between using regex and
string replacement as an example of lower hanging optimization fruit, I
think you'll find the difference between invoking a function and
including a file to be on par. The function is by far the better
solution when considering speed.

Cheers,
Rob.
-- 
...
SwarmBuy.com - http://www.swarmbuy.com

Leveraging the buying power of the masses!
...

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] functions versus includes

2007-11-11 Thread Nathan Nobbe
On Nov 11, 2007 9:32 PM, Robert Cummings [EMAIL PROTECTED] wrote:

 On Mon, 2007-11-12 at 11:27 +1100, Chris wrote:
  Frank Lopes wrote:
   I just started using PHP and got to think...
  
   Without getting into the discussion of best practices, strictly from
   a performance perspective,
   what is faster: a function or an include?
  
   For example I have a block of text that needs to appear mutliple times
   throughout the site.
  
   Will I be better off creating a function with its contents and then
   later just calling the function or,
   will it be faster (from an execution perspective) for me to create an
   .inc file that gets included later on?
 
  Micro-optimization is pretty useless. I seriously doubt you would notice
  any difference in performance.
 
  This comes under the other discussions like about which is faster - a
  foreach/while/for loop.
 
  You'll find other bottlenecks (eg changing a regex to do an str_replace)
  which will make a bigger difference.

 Actually, if you're going to use a comparison between using regex and
 string replacement as an example of lower hanging optimization fruit, I
 think you'll find the difference between invoking a function and
 including a file to be on par. The function is by far the better
 solution when considering speed.


rob is right.  i said screw it and wrote out a series of test scripts; just
got
curious.  so, there is one file which includes an external script that
operates
on a variable in global scope; then there is a script which defines a
function
internally; then there is a script which includes another script with that
function
defined in it.
the last one won each time; quite to my surprise.

[EMAIL PROTECTED] ~/working/www/phpExperiments/functionVsInclude $ php
mainWInclude.php
10
totalTime: 0.001057
[EMAIL PROTECTED] ~/working/www/phpExperiments/functionVsInclude $ php
mainWFunction.php
10
totalTime: 0.000642
[EMAIL PROTECTED] ~/working/www/phpExperiments/functionVsInclude $ php
mainWExternalFunction.php
10
totalTime: 0.000604


ill show the code if anyone wants it.

-nathan


Re: [PHP] functions versus includes

2007-11-11 Thread Chris

Nathan Nobbe wrote:



On Nov 11, 2007 9:32 PM, Robert Cummings [EMAIL PROTECTED] 
mailto:[EMAIL PROTECTED] wrote:


On Mon, 2007-11-12 at 11:27 +1100, Chris wrote:
  Frank Lopes wrote:
   I just started using PHP and got to think...
  
   Without getting into the discussion of best practices,
strictly from
   a performance perspective,
   what is faster: a function or an include?
  
   For example I have a block of text that needs to appear
mutliple times
   throughout the site.
  
   Will I be better off creating a function with its contents and then
   later just calling the function or,
   will it be faster (from an execution perspective) for me to
create an
   .inc file that gets included later on?
 
  Micro-optimization is pretty useless. I seriously doubt you would
notice
  any difference in performance.
 
  This comes under the other discussions like about which is faster
- a
  foreach/while/for loop.
 
  You'll find other bottlenecks (eg changing a regex to do an
str_replace)
  which will make a bigger difference.

Actually, if you're going to use a comparison between using regex and
string replacement as an example of lower hanging optimization fruit, I
think you'll find the difference between invoking a function and
including a file to be on par. The function is by far the better
solution when considering speed.


rob is right.  i said screw it and wrote out a series of test scripts; 
just got
curious.  so, there is one file which includes an external script that 
operates
on a variable in global scope; then there is a script which defines a 
function
internally; then there is a script which includes another script with 
that function

defined in it.
the last one won each time; quite to my surprise.

[EMAIL PROTECTED] ~/working/www/phpExperiments/functionVsInclude $ php 
mainWInclude.php

10
totalTime: 0.001057
[EMAIL PROTECTED] ~/working/www/phpExperiments/functionVsInclude $ php 
mainWFunction.php

10
totalTime: 0.000642
[EMAIL PROTECTED] ~/working/www/phpExperiments/functionVsInclude $ php 
mainWExternalFunction.php

10
totalTime: 0.000604


As I said, it's a micro-optimization *shrug*. 0.0004 seconds difference 
over 10 iterations - wow ;)


--
Postgresql  php tutorials
http://www.designmagick.com/

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] functions versus includes

2007-11-11 Thread Nathan Nobbe
On Nov 11, 2007 11:52 PM, Chris [EMAIL PROTECTED] wrote:

 As I said, it's a micro-optimization *shrug*. 0.0004 seconds difference
 over 10 iterations - wow ;)


actually it was just one iteration; the output isnt very clear, but thats
the
value of a variable.
anyway, i was surprised to see the function was faster at all.  i though the
include would be faster.
so not only is the function faster (if only but a bit) its also cleaner as
well.
i think a decision between the 2 approaches no-brainer.

-nathan


Re: [PHP] functions versus includes

2007-11-11 Thread Chris

Nathan Nobbe wrote:
On Nov 11, 2007 11:52 PM, Chris [EMAIL PROTECTED] 
mailto:[EMAIL PROTECTED] wrote:


As I said, it's a micro-optimization *shrug*. 0.0004 seconds difference
over 10 iterations - wow ;)


actually it was just one iteration; the output isnt very clear, but 
thats the

value of a variable.
anyway, i was surprised to see the function was faster at all.  i though the
include would be faster.
so not only is the function faster (if only but a bit) its also cleaner 
as well.

i think a decision between the 2 approaches no-brainer.


I'd go for the approach that makes more sense in the application 
regardless of the milliseconds involved. If that's an include that's 
what I'll use.


In the scheme of the whole app it won't make any difference.

You'll waste so much time on optimizing crap like this when fixing a 
bad database query will actually make a noticable difference, or instead 
of calling a function inside a loop 50 times, you call it once and pass 
all the data in through an array.


--
Postgresql  php tutorials
http://www.designmagick.com/

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] functions for sorting/paging functionality for imap mailboxes

2007-07-02 Thread Greg Donald

On 6/25/07, Yashesh Bhatia [EMAIL PROTECTED] wrote:

  i'm implementing an imap based mail client


That's a major wheel to go reinventing, have you not tried IMP/Horde?

http://www.horde.org/imp/


--
Greg Donald
http://destiney.com/

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] functions for sorting/paging functionality for imap mailboxes

2007-06-25 Thread Yashesh Bhatia

hello,

 i'm implementing an imap based mail client and want to provide
sorting / paging functionality for the inbox. there's a function to
retrieve headers
imap_headers (http://www.php.net/imap_headers) however, this gets
headers for all messages in a mailbox(inbox).

is there any function that will fetch headers similar to a SQL LIMIT
clause (LIMIT offset, row_count)  - so something like fetch 10 headers
starting from 11.

 the sorting can be accomplished by the function imap_sort so i'm
kindof stuck to get the paging functionality efficiently. (of course one can get
all headers and then use the array index to simulate limit offset, row_count).

thanks in advance.

yashesh bhatia


Go Pre
http://www2.localaccess.com/rlalonde/pre.htm


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Reuse PHP functions in a third-party application

2007-03-23 Thread Richard Lynch
On Wed, March 21, 2007 3:34 am, Robert Enyedi wrote:
 Thanks for the info. Under these circumstances I suppose that the CGI
 calling mode is the best suited.

 On the other hand this option might raise some performance penalty. I
 wonder if better performance could be achieved if I would use a socket
 based call interface to my module running inside the running PHP
 server.

Possibly.

Worth trying if you can get the sockets to work quickly.

You could always try the CLI first, and see if performance is good
enough

-- 
Some people have a gift link here.
Know what I want?
I want you to buy a CD from some indie artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Reuse PHP functions in a third-party application

2007-03-21 Thread Robert Enyedi

Richard,

Thanks for the info. Under these circumstances I suppose that the CGI 
calling mode is the best suited.


On the other hand this option might raise some performance penalty. I 
wonder if better performance could be achieved if I would use a socket 
based call interface to my module running inside the running PHP server.


Regards,
Robert

Richard Lynch wrote:

On Tue, March 20, 2007 5:27 am, Robert Enyedi wrote:

I'm not very familiar with the internal architecture of the Zend PHP
engine nor with the PHP module mechanism, but can you reuse compiled
PHP
modules in other applications?

Is there a way of calling the functions of a compiled module from a
third party C application?


Probably not...

I suppose that Prioblender thingie or one of the compilers might be
able to be hacked with a PHP CLI binary to kind of do that, but a base
PHP install doesn't ever actually store the opcodes anywhere in a
compiled form as you are imagining.

Even the various Caches only store opcode, and not machine
code/binaries, so you still need the Zend Engine to rip through and
execute them somewhere somehow, I think.

Of course, you could use PHP to provide REST, SOAP, WebDAV, etc



--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Re: Reuse PHP functions in a third-party application

2007-03-21 Thread Mikey

Robert Enyedi wrote:
I'm not very familiar with the internal architecture of the Zend PHP 
engine nor with the PHP module mechanism, but can you reuse compiled PHP 
modules in other applications?


Is there a way of calling the functions of a compiled module from a 
third party C application?


Thanks,
Robert


Compiled PHP modules could be loaded by any C program (as with any C 
shared object) but there would be a large number of hoops you would have 
to jump through before you would be able to make any function calls. 
However, is the module you wish to use something that is available 
exclusively to PHP?  Most modules are wrappers around existing C 
libraries and as such it would be much easier to just use the base 
library rather than trying to emulate a SAPI to load a PHP module.


If you still want to go down this path, then reading the manual section 
about creating PHP modules will give you an insight into how this 
process works.


Mikey

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Reuse PHP functions in a third-party application

2007-03-20 Thread Robert Enyedi
I'm not very familiar with the internal architecture of the Zend PHP 
engine nor with the PHP module mechanism, but can you reuse compiled PHP 
modules in other applications?


Is there a way of calling the functions of a compiled module from a 
third party C application?


Thanks,
Robert

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Reuse PHP functions in a third-party application

2007-03-20 Thread Tijnema !

On 3/20/07, Robert Enyedi [EMAIL PROTECTED] wrote:

I'm not very familiar with the internal architecture of the Zend PHP
engine nor with the PHP module mechanism, but can you reuse compiled PHP
modules in other applications?

Is there a way of calling the functions of a compiled module from a
third party C application?

Thanks,
Robert


I have no idea if it is possible, but i don't think so, what you can
do is calling the PHP script with the PHP CLI.

Tijnema


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Reuse PHP functions in a third-party application

2007-03-20 Thread Richard Lynch
On Tue, March 20, 2007 5:27 am, Robert Enyedi wrote:
 I'm not very familiar with the internal architecture of the Zend PHP
 engine nor with the PHP module mechanism, but can you reuse compiled
 PHP
 modules in other applications?

 Is there a way of calling the functions of a compiled module from a
 third party C application?

Probably not...

I suppose that Prioblender thingie or one of the compilers might be
able to be hacked with a PHP CLI binary to kind of do that, but a base
PHP install doesn't ever actually store the opcodes anywhere in a
compiled form as you are imagining.

Even the various Caches only store opcode, and not machine
code/binaries, so you still need the Zend Engine to rip through and
execute them somewhere somehow, I think.

Of course, you could use PHP to provide REST, SOAP, WebDAV, etc

-- 
Some people have a gift link here.
Know what I want?
I want you to buy a CD from some starving artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] PHP Functions as XML or DB

2007-01-21 Thread WeberSites LTD
Hi
 
I'm looking to create a Table that holds all of the PHP Functions, their
description and syntax. 

It's all in the manual and I'm trying to extract it from there but I find it
hard since the HTML template is not the same for all the functions. 

I may be going about this the wrong way... is there an easier way? 
 
thanks
 
berber


Re: [PHP] PHP Functions as XML or DB

2007-01-21 Thread Sergiu Voicu
CopyPaste man ;) (Just kidding) Now, seriously, I myself would write a 
parser for this, fetch some raw data from the pages, and do further 
processing on those.


I didn't checked yet, but I am almost sure that there may be only a few 
variations of the manual's used html template, and I don't think that it 
would take you two much time to figure out ways to extract data from 
each of this variations.


On the other hand, I think that this would be a good question to be put 
on the PHP Manual Mailing List. I am almost sure that somebody already 
has done this and can help you with it.


sergiu


WeberSites LTD wrote:

Hi
 
I'm looking to create a Table that holds all of the PHP Functions, their
description and syntax. 


It's all in the manual and I'm trying to extract it from there but I find it
hard since the HTML template is not the same for all the functions. 

I may be going about this the wrong way... is there an easier way? 
 
thanks
 
berber




--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] PHP Functions as XML or DB

2007-01-21 Thread Roman Neuhauser
# [EMAIL PROTECTED] / 2007-01-21 17:04:43 +0200:
 I'm looking to create a Table that holds all of the PHP Functions, their
 description and syntax. 
 
 It's all in the manual and I'm trying to extract it from there but I find it
 hard since the HTML template is not the same for all the functions. 
 
 I may be going about this the wrong way... is there an easier way? 

The canonical source for the manual is in DocBook, the various formats
are produced automatically from that.

-- 
How many Vietnam vets does it take to screw in a light bulb?
You don't know, man.  You don't KNOW.
Cause you weren't THERE. http://bash.org/?255991

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Re: Organizing php functions

2006-09-03 Thread Ivo F.A.C. Fokkema
On Fri, 01 Sep 2006 21:35:32 -0600, The Doctor wrote:

 The question comes up because:
 
 Sort file in the path interfere with one another
 
 which leads to
 
 web page malfunction.
 
 Question: should all php programmes such as drupal be placed
 under /usr/local/lib ?

I'm not getting the 'sort file' problem, but you can put PHP apps
wherever; as long as you tell Apache/your webserver where to find it.

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Functions vs html outpuit

2006-09-01 Thread Dave Goodchild

Hi all, this may seem like a silly question, but I am creating a library of
html form element generation function, for example a textarea fucntion that
takes rows and cols as parameters, a function that generates a day, month
and year select box, etc. My question is - is it significantly to switch off
the parser and emit raw html than calling a function? If it is faster to
just allow the server to send the html I will not bother.

--
http://www.web-buddha.co.uk
http://www.projectkarma.co.uk


[PHP] Organizing php functions

2006-09-01 Thread The Doctor
The question comes up because:

Sort file in the path interfere with one another

which leads to

web page malfunction.

Question: should all php programmes such as drupal be placed
under /usr/local/lib ?

-- 
Member - Liberal International  
This is [EMAIL PROTECTED]   Ici [EMAIL PROTECTED]
God Queen and country! Beware Anti-Christ rising!
New Brunswick kick out the Harper Puppet and VOTE LIBERAL on 18 Sept 2006

-- 
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] functions classes

2006-08-26 Thread Alex Turner

Larry,

I have hit similar global names space issues in the past and it is a 
pain in the behind!


One remedial method that can get it stable enough to start to work on is 
to stick the whole messy lot into classes (NOT OBJECTS!) and then the 
global name space becomes the local namespace (ie $MyVar becomes 
$GarbageCode::MyVar).


Once you have done this, you can put accessors functions around the 
class local variables.  This means that all new code calls the accessors.


$newVar=GarbageCode::GetMyVar();

Thus, if you improve the internal representation of the garbage code, 
code outside the old garbage code will no longer be impacted by the change.


From an FN point of view, you are reducing the access to the variable 
to a single function point rather than many function points distributed 
throughout the code base.


Cheers

AJ

PS - if you knew all this before hand - please accept my apologies :-)

Larry Garfield wrote:

On Friday 25 August 2006 04:39, Bigmark wrote:

Can anyone tell me if it is relatively an easy process for an experienced
coder (not me) to convert a php script to mainly functions/classes.
I have my own script that i would like to make more streamlined as it is
becoming very difficult to work with.


That really depends on the nature of the code.  I've some code I have to work 
with now that is built around dumping all kinds of stuff into the global 
namespace, even from functions.  If I ever manage convince the author what an 
insanely bad idea that is, it will still be hell to fix because of the way 
it's built.


Most code probably isn't quite that bad, though.  Your code could already 
break down into functions quite nicely, or it could be easier to just start 
from scratch.  No way to tell without seeing the code.





--
www.deployview.com
www.nerds-central.com
www.project-network.com

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Brain Death - [PHP] functions classes

2006-08-26 Thread Alex Turner

I don't know what I was on when I wrote the previous post!

In php you cannot create static class variables in this way (doh) or at 
least I never have managed.  So when faced the this problem I replace 
what in C++ would be a class variable with a class function


comme ca:

class MyClass
{
function MyVar($val = null)
{
static $datum;
if(is_null($val))
{
return $datum;
}
$dataum=$val;
}

}

I definitely need more coffee!

AJ

Alex Turner wrote:

Larry,

I have hit similar global names space issues in the past and it is a 
pain in the behind!


One remedial method that can get it stable enough to start to work on is 
to stick the whole messy lot into classes (NOT OBJECTS!) and then the 
global name space becomes the local namespace (ie $MyVar becomes 
$GarbageCode::MyVar).


Once you have done this, you can put accessors functions around the 
class local variables.  This means that all new code calls the accessors.


$newVar=GarbageCode::GetMyVar();

Thus, if you improve the internal representation of the garbage code, 
code outside the old garbage code will no longer be impacted by the change.


 From an FN point of view, you are reducing the access to the variable 
to a single function point rather than many function points distributed 
throughout the code base.


Cheers

AJ

PS - if you knew all this before hand - please accept my apologies :-)

Larry Garfield wrote:

On Friday 25 August 2006 04:39, Bigmark wrote:
Can anyone tell me if it is relatively an easy process for an 
experienced

coder (not me) to convert a php script to mainly functions/classes.
I have my own script that i would like to make more streamlined as it is
becoming very difficult to work with.


That really depends on the nature of the code.  I've some code I have 
to work with now that is built around dumping all kinds of stuff into 
the global namespace, even from functions.  If I ever manage convince 
the author what an insanely bad idea that is, it will still be hell to 
fix because of the way it's built.


Most code probably isn't quite that bad, though.  Your code could 
already break down into functions quite nicely, or it could be easier 
to just start from scratch.  No way to tell without seeing the code.








--
www.deployview.com
www.nerds-central.com
www.project-network.com

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Brain Death - [PHP] functions classes

2006-08-26 Thread Robert Cummings
On Sat, 2006-08-26 at 12:49 +0100, Alex Turner wrote:
 I don't know what I was on when I wrote the previous post!
 
 In php you cannot create static class variables in this way (doh) or at 
 least I never have managed.  So when faced the this problem I replace 
 what in C++ would be a class variable with a class function
 
 comme ca:
 
 class MyClass
 {
  function MyVar($val = null)
  {
   static $datum;
   if(is_null($val))
   {
   return $datum;
   }
   $dataum=$val;
  }
 
 }
 
 I definitely need more coffee!

Talking about coffee... your above code could use some. Try this:

?php

class MyClass
{
function MyVar( $val=null )
{
static $datum;

if( $val === null )
{
return $datum;
}

$datum = $val;
 }
}

?

But also I'd recommend fixing the the problem whereby you
can't set $datum to the null value, otherwise you may run
into unexpected issues down the road.

?php

class MyClass
{
function MyVar( $val=null, $set=false )
{
static $datum;

if( $set === false )
{
return $datum;
}

$datum = $val;
 }
}

?

Cheers,
Rob.
-- 
..
| InterJinn Application Framework - http://www.interjinn.com |
::
| An application and templating framework for PHP. Boasting  |
| a powerful, scalable system for accessing system services  |
| such as forms, properties, sessions, and caches. InterJinn |
| also provides an extremely flexible architecture for   |
| creating re-usable components quickly and easily.  |
`'

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP] Brain Death - [PHP] functions classes

2006-08-26 Thread Robert Cummings
On Sat, 2006-08-26 at 16:51 +0100, Alex Turner wrote:
 Rob,
 
 I'd go along with the setting a var to null issue (in the cases
 I have worked so far on, there has not been a need to set variables
 to null).


Maybe so, but if a variable ever happens to contain null and you're not
aware of it, the value won't get updated.

 However, what is wrong with is_null()?

As a function call it's an order of magnitude slower than === null since
it incurs the overhead for a function call. There's nothing wrong with
your use of the is_null() function, but === null is just as clear, and
much faster so I thought I'd throw at you in line with your coffee
comment :)

Cheers,
Rob.
-- 
..
| InterJinn Application Framework - http://www.interjinn.com |
::
| An application and templating framework for PHP. Boasting  |
| a powerful, scalable system for accessing system services  |
| such as forms, properties, sessions, and caches. InterJinn |
| also provides an extremely flexible architecture for   |
| creating re-usable components quickly and easily.  |
`'

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP] Brain Death - [PHP] functions classes

2006-08-26 Thread Alex Turner
Cool!  That is a very good point - I'll remember to use '=== null' in future.  
Then at least my code will have enough coffee even if I don't!

Thanks - AJ

Alexander J Turner Ph.D.
www.deployview.com
www.nerds-central.blogspot.com
www.project-network.com

-Original Message-
From: Robert Cummings [mailto:[EMAIL PROTECTED] 
Sent: 26 August 2006 17:25
To: Alex Turner
Cc: php-general@lists.php.net
Subject: RE: [PHP] Brain Death - [PHP] functions classes

On Sat, 2006-08-26 at 16:51 +0100, Alex Turner wrote:
 Rob,
 
 I'd go along with the setting a var to null issue (in the cases
 I have worked so far on, there has not been a need to set variables
 to null).


Maybe so, but if a variable ever happens to contain null and you're not
aware of it, the value won't get updated.

 However, what is wrong with is_null()?

As a function call it's an order of magnitude slower than === null since
it incurs the overhead for a function call. There's nothing wrong with
your use of the is_null() function, but === null is just as clear, and
much faster so I thought I'd throw at you in line with your coffee
comment :)

Cheers,
Rob.
-- 
..
| InterJinn Application Framework - http://www.interjinn.com |
::
| An application and templating framework for PHP. Boasting  |
| a powerful, scalable system for accessing system services  |
| such as forms, properties, sessions, and caches. InterJinn |
| also provides an extremely flexible architecture for   |
| creating re-usable components quickly and easily.  |
`'


-- 
No virus found in this incoming message.
Checked by AVG Free Edition.
Version: 7.1.405 / Virus Database: 268.11.6/427 - Release Date: 24/08/2006
 

-- 
No virus found in this outgoing message.
Checked by AVG Free Edition.
Version: 7.1.405 / Virus Database: 268.11.6/427 - Release Date: 24/08/2006
 

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP] Brain Death - [PHP] functions classes

2006-08-26 Thread Alex Turner
Rob,

I'd go along with the setting a var to null issue (in the cases I have worked 
so far on, there has not been a need to set variables to null).  However, what 
is wrong with is_null()?

From the php manual chm:

(PHP 4 = 4.0.4, PHP 5)

is_null --  Finds whether a variable is NULL 
Description
bool is_null ( mixed var )

Finds whether the given variable is NULL. 

Parameters

var
The variable being evaluated. 

Return Values
Returns TRUE if var is null, FALSE otherwise.


And to be very pedantic - as null does not have a type then actually 'x === 
null' should evaluate to absurdity, but PHP is more pragmatic than that ;-)

Cheers - AJ

Alexander J Turner Ph.D.
www.deployview.com
www.nerds-central.blogspot.com
www.project-network.com

-Original Message-
From: Robert Cummings [mailto:[EMAIL PROTECTED] 
Sent: 26 August 2006 16:42
To: Alex Turner
Cc: php-general@lists.php.net
Subject: Re: [PHP] Brain Death - [PHP] functions classes

On Sat, 2006-08-26 at 12:49 +0100, Alex Turner wrote:
 I don't know what I was on when I wrote the previous post!
 
 In php you cannot create static class variables in this way (doh) or at 
 least I never have managed.  So when faced the this problem I replace 
 what in C++ would be a class variable with a class function
 
 comme ca:
 
 class MyClass
 {
  function MyVar($val = null)
  {
   static $datum;
   if(is_null($val))
   {
   return $datum;
   }
   $dataum=$val;
  }
 
 }
 
 I definitely need more coffee!

Talking about coffee... your above code could use some. Try this:

?php

class MyClass
{
function MyVar( $val=null )
{
static $datum;

if( $val === null )
{
return $datum;
}

$datum = $val;
 }
}

?

But also I'd recommend fixing the the problem whereby you
can't set $datum to the null value, otherwise you may run
into unexpected issues down the road.

?php

class MyClass
{
function MyVar( $val=null, $set=false )
{
static $datum;

if( $set === false )
{
return $datum;
}

$datum = $val;
 }
}

?

Cheers,
Rob.
-- 
..
| InterJinn Application Framework - http://www.interjinn.com |
::
| An application and templating framework for PHP. Boasting  |
| a powerful, scalable system for accessing system services  |
| such as forms, properties, sessions, and caches. InterJinn |
| also provides an extremely flexible architecture for   |
| creating re-usable components quickly and easily.  |
`'


-- 
No virus found in this incoming message.
Checked by AVG Free Edition.
Version: 7.1.405 / Virus Database: 268.11.6/427 - Release Date: 24/08/2006
 

-- 
No virus found in this outgoing message.
Checked by AVG Free Edition.
Version: 7.1.405 / Virus Database: 268.11.6/427 - Release Date: 24/08/2006
 

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP] Brain Death - [PHP] functions classes

2006-08-26 Thread tedd

At 4:51 PM +0100 8/26/06, Alex Turner wrote:
And to be very pedantic - as null does not have a type then actually 
'x === null' should evaluate to absurdity, but PHP is more pragmatic 
than that ;-)


That's a very good point.

While one NULL variable in php can be compared to another NULL 
variable and produce true, it's not so in MySQL.


In MySQL NULL does not equal NULL -- such comparisons produces NULL 
and not true. Instead you have to use IS_NULL or NOT NULL to check 
for NULL.


So, it's probably best to get into the habit of using is_null.

tedd

--
---
http://sperling.com  http://ancientstones.com  http://earthstones.com

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP] Brain Death - [PHP] functions classes

2006-08-26 Thread Robert Cummings
On Sat, 2006-08-26 at 12:41 -0400, tedd wrote:
 At 4:51 PM +0100 8/26/06, Alex Turner wrote:
 And to be very pedantic - as null does not have a type then actually 
 'x === null' should evaluate to absurdity, but PHP is more pragmatic 
 than that ;-)
 
 That's a very good point.
 
 While one NULL variable in php can be compared to another NULL 
 variable and produce true, it's not so in MySQL.
 
 In MySQL NULL does not equal NULL -- such comparisons produces NULL 
 and not true. Instead you have to use IS_NULL or NOT NULL to check 
 for NULL.
 
 So, it's probably best to get into the habit of using is_null.

I strongly disagree... If I'm writing SQL then I adhere to the language
constructs of SQL, if I'm coding in PHP then I adhere to the language
constructs of PHP. There is no reason why one should forgo better
constructs just because they don't appear in other languages. When in
Rome... Oh btw, PHP draws strongly from C, and in C NULL == NULL, and
last I checked C predates SQL.

Cheers,
Rob.
-- 
..
| InterJinn Application Framework - http://www.interjinn.com |
::
| An application and templating framework for PHP. Boasting  |
| a powerful, scalable system for accessing system services  |
| such as forms, properties, sessions, and caches. InterJinn |
| also provides an extremely flexible architecture for   |
| creating re-usable components quickly and easily.  |
`'

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP] Brain Death - [PHP] functions classes

2006-08-26 Thread tedd

At 2:30 PM -0400 8/26/06, Robert Cummings wrote:

On Sat, 2006-08-26 at 12:41 -0400, tedd wrote:
  At 4:51 PM +0100 8/26/06, Alex Turner wrote:

 And to be very pedantic - as null does not have a type then actually

  'x === null' should evaluate to absurdity, but PHP is more pragmatic

 than that ;-)

 That's a very good point.

 While one NULL variable in php can be compared to another NULL
 variable and produce true, it's not so in MySQL.

 In MySQL NULL does not equal NULL -- such comparisons produces NULL
 and not true. Instead you have to use IS_NULL or NOT NULL to check
 for NULL.

 So, it's probably best to get into the habit of using is_null.


I strongly disagree... If I'm writing SQL then I adhere to the language
constructs of SQL, if I'm coding in PHP then I adhere to the language
constructs of PHP. There is no reason why one should forgo better
constructs just because they don't appear in other languages. When in
Rome... Oh btw, PHP draws strongly from C, and in C NULL == NULL, and
last I checked C predates SQL.

Cheers,
Rob.


Rob:

As the old woman who kissed the cow said To each their own.

My reasoning is simple and I don't strongly agree, or disagree, with 
other methodologies. I write in several languages, such as php, js, 
mySQL, css, and others -- and each have their own constructs. As 
such, I try to use similar constructs where ever possible. My memory 
isn't what it used to be.


Besides, what Alex Turner said about NULL is correct -- it's absurd 
to have NULL evaluate to anything. Just because one language allows 
absurdity doesn't mean you have to practice it.


Your mileage may differ and that's Okay.  :-)

tedd

--
---
http://sperling.com  http://ancientstones.com  http://earthstones.com

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP] Brain Death - [PHP] functions classes

2006-08-26 Thread Robert Cummings
On Sat, 2006-08-26 at 14:23 -0400, tedd wrote:
 At 2:30 PM -0400 8/26/06, Robert Cummings wrote:
 On Sat, 2006-08-26 at 12:41 -0400, tedd wrote:
At 4:51 PM +0100 8/26/06, Alex Turner wrote:
   And to be very pedantic - as null does not have a type then actually
'x === null' should evaluate to absurdity, but PHP is more pragmatic
   than that ;-)
 
   That's a very good point.
 
   While one NULL variable in php can be compared to another NULL
   variable and produce true, it's not so in MySQL.
 
   In MySQL NULL does not equal NULL -- such comparisons produces NULL
   and not true. Instead you have to use IS_NULL or NOT NULL to check
   for NULL.
 
   So, it's probably best to get into the habit of using is_null.
 
 I strongly disagree... If I'm writing SQL then I adhere to the language
 constructs of SQL, if I'm coding in PHP then I adhere to the language
 constructs of PHP. There is no reason why one should forgo better
 constructs just because they don't appear in other languages. When in
 Rome... Oh btw, PHP draws strongly from C, and in C NULL == NULL, and
 last I checked C predates SQL.
 
 Cheers,
 Rob.
 
 Rob:
 
 As the old woman who kissed the cow said To each their own.
 
 My reasoning is simple and I don't strongly agree, or disagree, with 
 other methodologies. I write in several languages, such as php, js, 
 mySQL, css, and others -- and each have their own constructs. As 
 such, I try to use similar constructs where ever possible. My memory 
 isn't what it used to be.
 
 Besides, what Alex Turner said about NULL is correct -- it's absurd 
 to have NULL evaluate to anything. Just because one language allows 
 absurdity doesn't mean you have to practice it.

One language? I know for certain that PHP, C, PERL, and JavaScript all
return true for comparisons of null to itself. I know quite a few
languages too... though I'm not sure why you threw CSS in there since
the concept of null doesn't apply.

 Your mileage may differ and that's Okay.  :-)

As always :)

Cheers,
Rob.
-- 
..
| InterJinn Application Framework - http://www.interjinn.com |
::
| An application and templating framework for PHP. Boasting  |
| a powerful, scalable system for accessing system services  |
| such as forms, properties, sessions, and caches. InterJinn |
| also provides an extremely flexible architecture for   |
| creating re-usable components quickly and easily.  |
`'

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP] Brain Death - [PHP] functions classes

2006-08-26 Thread Alex Turner
Right or wrong - C does not actually have NULL :-)  NULL in C is simply mapped 
to zero.  It is useful in logic to sometimes use mapping of logical sentence 
letters to numbers and use mathematics to perform proof, but that is a special 
case.  

In languages like C, there is no special method of marking a variable as true 
NULL.  Thus, the language has no way of processing three state logic.  In SQL, 
there is a special flag to note that variables are truly null and so it can 
process three state logic.

PHP is odd because it does have a special NULL state but it does not fully 
support three state logic.  But hey - it is a web scripting language - it would 
be a shame if PHP got all theoretical on us!

BTW:
Rome... Oh btw, PHP draws strongly from C, and in C NULL == NULL, and

NULL == NULL === TRUE

It is

NULL === NULL == absurd.

So - my approach:

I may well use is_null() in low traffic areas on PHP, but then when in an inner 
loop etc, use === null and maybe comment what it means.

Cheers to all

AJ


Alexander J Turner Ph.D.
www.deployview.com
www.nerds-central.blogspot.com
www.project-network.com

-Original Message-
From: tedd [mailto:[EMAIL PROTECTED] 
Sent: 26 August 2006 19:24
To: Robert Cummings; tedd
Cc: Alex Turner; php-general@lists.php.net
Subject: RE: [PHP] Brain Death - [PHP] functions classes

At 2:30 PM -0400 8/26/06, Robert Cummings wrote:
On Sat, 2006-08-26 at 12:41 -0400, tedd wrote:
   At 4:51 PM +0100 8/26/06, Alex Turner wrote:
  And to be very pedantic - as null does not have a type then actually
   'x === null' should evaluate to absurdity, but PHP is more pragmatic
  than that ;-)

  That's a very good point.

  While one NULL variable in php can be compared to another NULL
  variable and produce true, it's not so in MySQL.

  In MySQL NULL does not equal NULL -- such comparisons produces NULL
  and not true. Instead you have to use IS_NULL or NOT NULL to check
  for NULL.

  So, it's probably best to get into the habit of using is_null.

I strongly disagree... If I'm writing SQL then I adhere to the language
constructs of SQL, if I'm coding in PHP then I adhere to the language
constructs of PHP. There is no reason why one should forgo better
constructs just because they don't appear in other languages. When in
Rome... Oh btw, PHP draws strongly from C, and in C NULL == NULL, and
last I checked C predates SQL.

Cheers,
Rob.

Rob:

As the old woman who kissed the cow said To each their own.

My reasoning is simple and I don't strongly agree, or disagree, with 
other methodologies. I write in several languages, such as php, js, 
mySQL, css, and others -- and each have their own constructs. As 
such, I try to use similar constructs where ever possible. My memory 
isn't what it used to be.

Besides, what Alex Turner said about NULL is correct -- it's absurd 
to have NULL evaluate to anything. Just because one language allows 
absurdity doesn't mean you have to practice it.

Your mileage may differ and that's Okay.  :-)

tedd

-- 
---
http://sperling.com  http://ancientstones.com  http://earthstones.com

-- 
No virus found in this incoming message.
Checked by AVG Free Edition.
Version: 7.1.405 / Virus Database: 268.11.6/427 - Release Date: 24/08/2006
 

-- 
No virus found in this outgoing message.
Checked by AVG Free Edition.
Version: 7.1.405 / Virus Database: 268.11.6/427 - Release Date: 24/08/2006
 

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP] Brain Death - [PHP] functions classes

2006-08-26 Thread Robert Cummings
On Sat, 2006-08-26 at 15:38 -0400, tedd wrote:
 At 3:04 PM -0400 8/26/06, Robert Cummings wrote:
 On Sat, 2006-08-26 at 14:23 -0400, tedd wrote:
 
Besides, what Alex Turner said about NULL is correct -- it's absurd
   to have NULL evaluate to anything. Just because one language allows
   absurdity doesn't mean you have to practice it.
 
 One language? I know for certain that PHP, C, PERL, and JavaScript all
 return true for comparisons of null to itself. I know quite a few
 languages too...
 
 The following said using the accent of Dr. Zoidberg.
 
 One, 18 kazillion, what does it matter? How many wrongs does it take 
 to make it right?

*lol* But the same statement applies to the converse argument also :)

 though I'm not sure why you threw CSS in there since
 the concept of null doesn't apply.
 
 Ahh, I threw that in there was just because I use it and I'm trying 
 to impress you. :-)

Aww shucks *blushes*.

 True, css doesn't have a NULL, but that just means it's NULL in the 
 NULL department, right?  :-)

*groan* ;)

Cheers,
Rob.
-- 
..
| InterJinn Application Framework - http://www.interjinn.com |
::
| An application and templating framework for PHP. Boasting  |
| a powerful, scalable system for accessing system services  |
| such as forms, properties, sessions, and caches. InterJinn |
| also provides an extremely flexible architecture for   |
| creating re-usable components quickly and easily.  |
`'

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP] Brain Death - [PHP] functions classes

2006-08-26 Thread tedd

At 3:04 PM -0400 8/26/06, Robert Cummings wrote:

On Sat, 2006-08-26 at 14:23 -0400, tedd wrote:

  Besides, what Alex Turner said about NULL is correct -- it's absurd

 to have NULL evaluate to anything. Just because one language allows
 absurdity doesn't mean you have to practice it.


One language? I know for certain that PHP, C, PERL, and JavaScript all
return true for comparisons of null to itself. I know quite a few
languages too...


The following said using the accent of Dr. Zoidberg.

One, 18 kazillion, what does it matter? How many wrongs does it take 
to make it right?



though I'm not sure why you threw CSS in there since
the concept of null doesn't apply.


Ahh, I threw that in there was just because I use it and I'm trying 
to impress you. :-)


True, css doesn't have a NULL, but that just means it's NULL in the 
NULL department, right?  :-)


Cheers,

tedd
--
---
http://sperling.com  http://ancientstones.com  http://earthstones.com

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] functions classes

2006-08-25 Thread Bigmark
Can anyone tell me if it is relatively an easy process for an experienced
coder (not me) to convert a php script to mainly functions/classes.
I have my own script that i would like to make more streamlined as it is
becoming very difficult to work with.

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



  1   2   3   >