[PHP] Migrating legacy code - changing session name

2010-01-26 Thread Rory McKinley
Hello List

A client has asked me to migrate a few scripts that have been running
merrily under PHP4 to PHP5.2. Part of these scripts have integration
with PHPMyAdmin
using the single sign-on and so they make use of the following code :

session_write_close();
session_name(blah);
session_start();

Now, assuming that prior to session_write_close(), I have a session
that (amongst other elements) contains the following:

$_SESSION['a'] = (an instance of Object A)
$_SESSION['b'] = (an instance of Object B)
$_SESSION['c'] = (an instance of Object C)

After session_start(), I have the following :

$_SESSION['a'] = (an instance of Object C)
$_SESSION['b'] = (an instance of Object C)
$_SESSION['c'] = (an instance of Object C)

This does not consistently happen, only under particular circumstances
(it seems to be a certain set of elements in $_SESSION triggers it).
For instance, if I unset $_SESSION['b'] * prior* to doing
session_write_close() - the behaviour stops, and the elements are
retained. Has anybody seen this before?


Vital Stats:

PHP5.2
Apache1.3
FastCGI
Sessions are stored using PHP5's default session handling.

Thanks in advance

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



Re: [PHP] If the first four characters are 0000, then do {}

2010-01-26 Thread shiplu
Another technique could be.

$s = $mydata-restored;

if($s[0]==$s[1]
  $s[1]==$s[2]
  $s[2]==$s[3]
  $s[3]==0){

do_work();
}


But I think you got the best solution already.

-- 
Shiplu Mokaddim
My talks, http://talk.cmyweb.net
Follow me, http://twitter.com/shiplu
SUST Programmers, http://groups.google.com/group/p2psust
Innovation distinguishes bet ... ... (ask Steve Jobs the rest)

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



[PHP] Re: Recursion issue with Zend_Soap_AutoDiscovery.

2010-01-26 Thread Richard Quadling
2010/1/25 Nathan Rixham nrix...@gmail.com:
 Richard Quadling wrote:
 Hi.

 I'm in the process of building a web service which incorporates the
 ability for the server to inform the client that a particular call has
 been superseded by another.

 So, cut down (I've removed all the other details), ...

 class ServiceDetails
       {
       /**
        * Superseded by
        *
        * Details of the replacement service that is now available.
        *
        * @var ServiceDetails
        */
       public $SupersededBy = Null;
       }

 When I try to use Zend_Soap_AutoDiscover() against this class, I get ...

 Infinite recursion, cannot nest 'ServiceDetails' into itsself. (sic)

 There has to be recursion, as there could be many levels of
 supersedence, each one providing the details of their own replacement.

 The call to return the service details read the requested
 services/class constants. If there is a superseded entry, it creates a
 new request for service details on the new class (the recursion).

 If the value is Null, then there is no recursion.



 I'm using ...

 new Zend_Soap_AutoDiscover('Zend_Soap_Wsdl_Strategy_ArrayOfTypeComplex');

 as the strategy as the service has arrays of complex types in the output.



 If I use @var string and then manually replace the type in the WSDL
 file from ...

           xsd:element name=SupersededBy type=xsd:string /

 to

           xsd:element name=SupersededBy type=tns:ServiceDetails /

 and use wsdl2php against this, it all _SEEMS_ to work OK.

 So. Is this my best option? Or is there a way to do this that I'm missing?


 Any ideas really.


 http://wso2.org/projects/wsf/php ;)

 helpful eh


Not yet! I'm on windows and I'm not confident enough to put extensions
I've built out on the live servers.

Also, it is using VC8 and I'm on 5.3 (VC9, x86, nts). So not tested.



-- 
-
Richard Quadling
Standing on the shoulders of some very clever giants!
EE : http://www.experts-exchange.com/M_248814.html
EE4Free : http://www.experts-exchange.com/becomeAnExpert.jsp
Zend Certified Engineer : http://zend.com/zce.php?c=ZEND002498r=213474731
ZOPA : http://uk.zopa.com/member/RQuadling

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



Re: [PHP] Speed of sending email .. can I put them in a queue rather than wait?

2010-01-26 Thread Eric Lee
On Tue, Jan 26, 2010 at 12:02 PM, Angus Mann angusm...@pobox.com wrote:

 Hi all.

 I'm currently using the phpmailer class from phpmailer.worxware.com to
 send datatbase -populated emails to clients.

 At the moment I'm runninng PHP on Windows and using the built-in sendmail
 equivalent packaged with XAMPP. It uses a remote SMTP that authenticates by
 prior logging into a POP account.

 The number of emails sent is very small. Each one is only sent after a user
 fills out a form and presses send.

 But there is a noticable lag of about 5 or sometimes 10 seconds after
 pressing send before the user sees the Mail sent page. I presume the
 reason for the lag is the time spent logging on and off a remote POP, then
 SMTP server, transferring the data etc.

 It would be better if this happened in the background - that is, the user
 could get on with doing his next task while the emails sat in a queue in the
 backgorund, being lined up and sent without PHP waiting for the process to
 finish.

 Can anybody recommend a good way of doing this? Is Mercury Mail going to
 help me here?


HI Angus,

+1 I agree on what Paul already said .
As in fact you were just to sent out low volume mails.
Create a table and queue all pending mails in that then use windows
scheduled tasks to perform the actual work
if that is not a real-time mail.


One thing to note, php on windows does't support specify username and
password.
But only hostname / IP Address and port only.


I can not help much
but just few more suggesions.

Hope these help

Eric,
Regards,


Re: [PHP] Re: Enforce a constant in a class.

2010-01-26 Thread Richard Quadling
2010/1/25 Colin Guthrie gm...@colin.guthr.ie:
 'Twas brillig, and Richard Quadling at 22/01/10 11:33 did gyre and gimble:
 Hello,

 One of the aspects of an interface is to enforce a public view of a
 class (as I see it).

 Within PHP, interfaces are allowed to have constants, but you cannot
 override them in a class implementing that interface.

 This seems wrong.

 The interface shouldn't define the value, just like it doesn't define
 the content of the method, it only defines its existence and requires
 that a class implementing the interface accurately matches the
 interface.

 Is there a reason for this behaviour?



 _OR_

 How do I enforce the presence of a constant in a class?

 ?php
 interface SetKillSwitch {
       const KILL_SWITCH_SET = True;

       // Produces an error as no definition exists.
       // const KILL_SWITCH_NOTES;

       // Cannot override in any class implementing this interface.
       const KILL_SWITCH_DATE = '2010-01-22T11:23:32+';
 }

 class KilledClass implements SetKillSwitch {
       // Cannot override as defined in interface SetKillSwitch.
       // const KILL_SWITCH_DATE = '2010-01-22T11:23:32+';
 }
 ?

 I want to enforce that any class implementing SetKillSwitch also has a
 const KILL_SWITCH_DATE and a const KILL_SWITCH_NOTES.

 I have to use reflection to see if the constant exists and throw an
 exception when it doesn't.

 The interface should only say that x, y and z must exist, not the
 values of x, y and z.

 Forgive the perhaps silly question but why are you requiring to use
 constants here.

 I appreciate the desire to use Reflection but why not just define a
 method that must be implemented in the interface?

 interface SetKillSwitch {
  public function getKillDate();
  public function getKillNotes();
 }


 By virtue of something impementing the interface, you know the methods
 will exist.

 If you want to make implmentation of classes easier, then define and
 abstract class with an appropriate constructor and implementation:


 abstract class SetKillSwitchAbstract {
  private $_killDate;
  private $_killNotes;
  protected function __construct($killDate, $killNotes)
  {
    $this-_killDate = $killDate;
    $this-_killNotes = $killNotes;
  }

  public function getKillDate()
  {
    return $this-_killDate;
  }

  public function getKillNotes()
  {
    return $this-_killNotes;
  }
 }


 You can either put your implements SetKillSwitch in this class or the
 derived classes depending on other methods you want to provide in the
 base class.


 I don't see why constants specifically are needed here. Rather than
 using reflection you can just use instanceof or similar to tell if a
 given object implements the interface or simply use the interface name
 as a type specifier on an argument to another function/method etc.


 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



With a constant, PhpDoc will pick up the value of the constant and
incorporate it into the documentation.

With a method, there is no way to know the return value. The type,
sure, but not the value.

Setting a constant is by far the simplest way to deal with this.

A method to return a constant is one method unneeded.

But, as I've said, I completely missed defined().

That's all I needed.

If the kill interface is applied to a class, then the parent class can
quite happily use defined(get_called_class() . '::KILL_SWITCH_SET') to
see if the class is defunct (or whatever).

Really. It was just the defined() call I missed. Everything is now working fine.

-- 
-
Richard Quadling
Standing on the shoulders of some very clever giants!
EE : http://www.experts-exchange.com/M_248814.html
EE4Free : http://www.experts-exchange.com/becomeAnExpert.jsp
Zend Certified Engineer : http://zend.com/zce.php?c=ZEND002498r=213474731
ZOPA : http://uk.zopa.com/member/RQuadling

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



Re: [PHP] strip out repeated ocurrence of a string

2010-01-26 Thread Al



On 1/25/2010 10:48 PM, Camilo Sperberg wrote:

Hello list :)

I have this problem, a certain string can contain the following information:


$string = '
hi{value1;value2}
bye{value1;value3}
hi{value1;value4}
hi{value1;value2}
bye{value1;value2}
';

What I want is to be able to get this result:

$string = '
hi{value1;value2}
bye{value1;value3}
hi{value1;value4}
bye{value1;value2}
';

(the order of appearance doesn't matter)
Is it even possible to do this with regular expressions? Or should I first
look if there is some kind of match and then apply an
str_replace($match,'',$string) and add the $match again?

Greetings !



Assuming the duplicate segments are identical.
I'd use explode() and convert the string to an array. Use } for the delimiter.
Then use array_unique()
And then use implode() to restore the string.



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



[PHP] preg_replace help

2010-01-26 Thread Michael A. Peters

$fixSrch[] = '/\n/';
$fixRplc[] = '[br]';

is what I need except I want it to leave anything between [code] and 
[/code] alone.


I figured it out before but with element /element but I don't even 
remember what I was working on when I did that and I can't for the life 
of me find it now.


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



Re: [PHP] preg_replace help

2010-01-26 Thread Kim Madsen

Michael A. Peters wrote on 26/01/2010 14:18:

$fixSrch[] = '/\n/';
$fixRplc[] = '[br]';

is what I need except I want it to leave anything between [code] and 
[/code] alone.


I figured it out before but with element /element but I don't even 
remember what I was working on when I did that and I can't for the life 
of me find it now.


Just use the function nl2br()

If you wanna match \n, you need to add a backslash before the 
backslash: \\n


--
Kind regards
Kim Emax - masterminds.dk

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



Re: [PHP] strip out repeated ocurrence of a string

2010-01-26 Thread Ashley Sheridan
On Tue, 2010-01-26 at 07:56 -0500, Al wrote:

 
 On 1/25/2010 10:48 PM, Camilo Sperberg wrote:
  Hello list :)
 
  I have this problem, a certain string can contain the following information:
 
 
  $string = '
  hi{value1;value2}
  bye{value1;value3}
  hi{value1;value4}
  hi{value1;value2}
  bye{value1;value2}
  ';
 
  What I want is to be able to get this result:
 
  $string = '
  hi{value1;value2}
  bye{value1;value3}
  hi{value1;value4}
  bye{value1;value2}
  ';
 
  (the order of appearance doesn't matter)
  Is it even possible to do this with regular expressions? Or should I first
  look if there is some kind of match and then apply an
  str_replace($match,'',$string) and add the $match again?
 
  Greetings !
 
 
 Assuming the duplicate segments are identical.
 I'd use explode() and convert the string to an array. Use } for the 
 delimiter.
 Then use array_unique()
 And then use implode() to restore the string.
 
 
 


Just did a bit of hunting as I know I've seen something similar to what
you're asking before.

If you're on a Linux system, try this:

awk '!x[$0]++' inputfile  outputfile

This seems to be the best way to remove duplicate lines and still
preserve the original order of the unique lines.

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




RE: [PHP] Speed of sending email .. can I put them in a queuerather than wait?

2010-01-26 Thread Bob McConnell
From: Paul M Foster
 On Tue, Jan 26, 2010 at 02:02:18PM +1000, Angus Mann wrote:

 I'm currently using the phpmailer class from phpmailer.worxware.com
 to send datatbase -populated emails to clients.
 
 At the moment I'm runninng PHP on Windows and using the built-in
 sendmail equivalent packaged with XAMPP. It uses a remote SMTP that
 authenticates by prior logging into a POP account.
 
 The number of emails sent is very small. Each one is only sent after
 a user fills out a form and presses send.
 
 But there is a noticable lag of about 5 or sometimes 10 seconds
 after pressing send before the user sees the Mail sent page.
 I presume the reason for the lag is the time spent logging on and
 off a remote POP, then SMTP server, transferring the data etc.
 
 It would be better if this happened in the background - that is, the
 user could get on with doing his next task while the emails sat in a
 queue in the backgorund, being lined up and sent without PHP waiting
 for the process to finish.
 
 Can anybody recommend a good way of doing this? Is Mercury Mail going
 to help me here?
 
 
 If this were me, I'd set up a mailserver on the web machine and send
 mail to it instead of using phpmailer to connect directly to a distant
 mailserver. The authentication between phpmailer and the local
 mailserver should be near instantaneous, and you can let the local
 mailserver deal with transferring mails in its own sweet time. I don't
 know if there's a mailserver included in XAMPP installations, but if
so,
 I'd do that. In fact, if you're just sending simple emails, you could
 use PHP's built-in mail() function, which will connect directly to the
 local mailserver without further configuration.

As another option, I have a simple SMTP script (Perl) that listens on
port 25, accepts all forwarded messages and appends them to a text file.
Since it doesn't actually do anything, it is all but instantaneous. I
use it as a black hole relay MTA for development and test servers that
can't reach the real world. If anyone is interested, let me know and I
can send you a copy. It is adapted from something I found via Google.

Bob McConnell

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



Re: [PHP] If the first four characters are 0000, then do {}

2010-01-26 Thread paragasu
maybe another way can be

$str = explode('-',$mydata-restored);

if($str[0] == '') { dostuff();}


;)

On 1/26/10, shiplu shiplu@gmail.com wrote:
 Another technique could be.

 $s = $mydata-restored;

 if($s[0]==$s[1]
   $s[1]==$s[2]
   $s[2]==$s[3]
   $s[3]==0){

 do_work();
 }


 But I think you got the best solution already.

 --
 Shiplu Mokaddim
 My talks, http://talk.cmyweb.net
 Follow me, http://twitter.com/shiplu
 SUST Programmers, http://groups.google.com/group/p2psust
 Innovation distinguishes bet ... ... (ask Steve Jobs the rest)

 --
 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] preg_replace help

2010-01-26 Thread Michael A. Peters

Kim Madsen wrote:

Michael A. Peters wrote on 26/01/2010 14:18:

$fixSrch[] = '/\n/';
$fixRplc[] = '[br]';

is what I need except I want it to leave anything between [code] and 
[/code] alone.


I figured it out before but with element /element but I don't even 
remember what I was working on when I did that and I can't for the 
life of me find it now.


Just use the function nl2br()

If you wanna match \n, you need to add a backslash before the 
backslash: \\n




No, I do NOT want to use nl2br.
For one thing, nl2br isn't xml safe so I'd have to do another 
preg_replace to fix that. My bbcode parser is xml safe.


For another thing, my bbcode parser doesn't like html in its input, and 
this needs to be done before the parser.


'/\n/','[br]'

works exactly as I want it to right now except I do not want it replace 
the newlines inside [code][/code] as that messes up the syntax 
highlighting that is then done one the code block.


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



Re: [PHP] Creating an Entire .html page with PHP

2010-01-26 Thread Ryan Sun
Isn't there a framework doing that?

On Mon, Jan 25, 2010 at 8:00 PM, deal...@gmail.com deal...@gmail.comwrote:

 Hi Folks,

 I would like to create an entire .html page gathered from database content
 mixed with html etc. and be able to save the page...


 like:

 --- save all this pre made content as .html page

 html
 head
 ...  stuff
 /head
 body
 ...  stuff
 ...  stuff with database query results...
 ...  stuff
 /body
 /html

 Q: Is there a function that might help with saving the whole content as
 .html page?



 Thanks,
 deal...@gmail.com
 [db-10]



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




Re: [PHP] strip out repeated ocurrence of a string

2010-01-26 Thread Camilo Sperberg

 a certain string can contain the following information:

 $string =
 'hi{value1;value2}bye{value1;value3}hi{value1;value4}hi{value1;value2}bye{value1;value2}';

 What I want is to be able to get this result:

 $string =
 'hi{value1;value2}bye{value1;value3}hi{value1;value4}bye{value1;value2}';

 (the order of appearance doesn't matter)


 Assuming the duplicate segments are identical.
 I'd use explode() and convert the string to an array. Use } for the
 delimiter.
 Then use array_unique()
 And then use implode() to restore the string.


Really nice solution indeed :D I didn't know array_unique() (well, that's
not entirely true, I had read about it once or twice, but didn't remembered
it).

Anyway, I remembered after I sended the mail that the order DO matter, but
that is just reversing an array :)
Just for the record, the applied code is:

$string =
implode('}',array_reverse(array_unique(array_reverse(explode('}',$string);

First, an explode of the string to create an array, than I reverse it so
that the last ocurrence of the repeated part will always be last, after that
I apply array_unique, de-reverse it and implode it all back together as a
string.

Result?
input:
hi{value1;value2}bye{value1;value3}hi{value1;value4}hi{value1;value2}bye{value1;value2}

output:
bye{value1;value3}hi{value1;value4}hi{value1;value2}bye{value1;value2}


Thank you very much !


@Ashley: It must be done in PHP, because it should run in any environment.
But thanks anyway, any help is apreciated: you just saw that there was a
much easier way than trying to use regular expressions or str_replace when
using arrays is considerably faster (especially because the $string won't be
a few bytes, it could range from ~5 bytes up to ~300+ KiB).

Greetings!

-- 
Mailed by:
UnReAl4U - unreal4u
ICQ #: 54472056
www1: http://www.chw.net/
www2: http://unreal4u.com/


Re: [PHP] Creating an Entire .html page with PHP

2010-01-26 Thread Ashley Sheridan
On Tue, 2010-01-26 at 09:55 -0500, Ryan Sun wrote:

 Isn't there a framework doing that?
 
 On Mon, Jan 25, 2010 at 8:00 PM, deal...@gmail.com deal...@gmail.comwrote:
 
  Hi Folks,
 
  I would like to create an entire .html page gathered from database content
  mixed with html etc. and be able to save the page...
 
 
  like:
 
  --- save all this pre made content as .html page
 
  html
  head
  ...  stuff
  /head
  body
  ...  stuff
  ...  stuff with database query results...
  ...  stuff
  /body
  /html
 
  Q: Is there a function that might help with saving the whole content as
  .html page?
 
 
 
  Thanks,
  deal...@gmail.com
  [db-10]
 
 
 
  --
  PHP General Mailing List (http://www.php.net/)
  To unsubscribe, visit: http://www.php.net/unsub.php
 
 


I think generally though, it's usual to have the pages created and
output on the fly, rather than output the .html page. Some CMS's do
publish the .html pages, but unless the page is created from very
complex content, or your site is expecting a large amount of traffic,
there's not much use to do it. I've heard people mention SEO as a
reason, but I've not seen any evidence, and there are ways via
mod_rewrite to mask the actual content pages.

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




Re: [PHP] preg_replace help

2010-01-26 Thread Michael A. Peters

Michael A. Peters wrote:

Kim Madsen wrote:

Michael A. Peters wrote on 26/01/2010 14:18:

$fixSrch[] = '/\n/';
$fixRplc[] = '[br]';

is what I need except I want it to leave anything between [code] and 
[/code] alone.


I figured it out before but with element /element but I don't 
even remember what I was working on when I did that and I can't for 
the life of me find it now.


Just use the function nl2br()

If you wanna match \n, you need to add a backslash before the 
backslash: \\n




No, I do NOT want to use nl2br.
For one thing, nl2br isn't xml safe so I'd have to do another 
preg_replace to fix that. My bbcode parser is xml safe.


For another thing, my bbcode parser doesn't like html in its input, and 
this needs to be done before the parser.


'/\n/','[br]'

works exactly as I want it to right now except I do not want it replace 
the newlines inside [code][/code] as that messes up the syntax 
highlighting that is then done one the code block.




I got it, though it may not be the most elegant way.

I split the input up into array and do the preg_replace on array 
elements that are not inside [code]. Seems to work, and also solves the 
other problem (other problem being proper application of strip_tags 
except inside [code].


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



Re: [PHP] Creating an Entire .html page with PHP

2010-01-26 Thread Michael A. Peters

Ashley Sheridan wrote:






I think generally though, it's usual to have the pages created and
output on the fly, rather than output the .html page.


Yes, though often using a cache if it is dynamic content that doesn't 
change often. No reason to hit the db continuously if the content is the 
same as when you hit it the last 278 times.


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



Re: [PHP] If the first four characters are 0000, then do {}

2010-01-26 Thread Daniel Brown
On Mon, Jan 25, 2010 at 22:51, Daevid Vincent dae...@daevid.com wrote:
 -Original Message-
 From: paras...@gmail.com [mailto:paras...@gmail.com] On
 Behalf Of Daniel Brown
 Sent: Monday, January 25, 2010 6:43 PM
 To: John Taylor-Johnston
 Cc: PHP-General
 Subject: Re: [PHP] If the first four characters are , then do {}

 On Mon, Jan 25, 2010 at 21:36, John Taylor-Johnston
 john.taylor-johns...@cegepsherbrooke.qc.ca wrote:
  I am reading the manual: http://ca.php.net/manual/en/ref.strings.php
 
  $mydata-restored = -00-00;

 ?php

 $o[] = '0942-23-23';
 $o[] = '-00-00';
 $o[] = '1238-00-00';
 $o[] = '0001-23-45';
 $o[] = '-11-22';

 for($i=0;$icount($o);$i++) {
         if(preg_match('/^[0]{4,}\-/U',$o[$i])) {
                 echo Offset #.$i. matches: .$o[$i].PHP_EOL;
         }
 }
 ?

 Holy macaroni. Talk about overkill!

 if (substr($mydata-restored,0,4) == ) { }

Overkill?

?php

$o[] = '0942-23-23';
$o[] = '-00-00';
$o[] = '1238-00-00';
$o[] = '0001-23-45';
$o[] = '-11-22';

$now = microtime();

for($i=0;$icount($o);$i++) {
   if(preg_match('/^[0]{4,}\-/U',$o[$i])) {
   //echo Offset #.$i. matches: .$o[$i].PHP_EOL;
   }
}

echo (microtime(1) - $now).\n;


$later = microtime();

for($i=0;$icount($o);$i++) {
if(substr($o[$i],0,4) == ) {
//echo Offset #.$i. matches: .$o[$i].PHP_EOL;
}
}

echo (microtime(1) - $later).\n;

?

 Sample Output:

1264522257.0001
1264522257

The preg_match() method, which is more expandable and adaptable
than relying on static position, took less than one-ten-thousandths of
a second longer to calculate than substr().

Just an FYI before you start worshipping pasta, Mr. Vincent.  ;-P

-- 
/Daniel P. Brown
daniel.br...@parasane.net || danbr...@php.net
http://www.parasane.net/ || http://www.pilotpig.net/
Looking for hosting or dedicated servers?  Ask me how we can fit your budget!

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



Re: [PHP] Migrating legacy code - changing session name

2010-01-26 Thread Jochem Maas
Op 1/26/10 9:25 AM, Rory McKinley schreef:
 Hello List
 
 A client has asked me to migrate a few scripts that have been running
 merrily under PHP4 to PHP5.2. Part of these scripts have integration
 with PHPMyAdmin
 using the single sign-on and so they make use of the following code :
 
 session_write_close();
 session_name(blah);
 session_start();
 
 Now, assuming that prior to session_write_close(), I have a session
 that (amongst other elements) contains the following:
 
 $_SESSION['a'] = (an instance of Object A)
 $_SESSION['b'] = (an instance of Object B)
 $_SESSION['c'] = (an instance of Object C)
 
 After session_start(), I have the following :
 
 $_SESSION['a'] = (an instance of Object C)
 $_SESSION['b'] = (an instance of Object C)
 $_SESSION['c'] = (an instance of Object C)

sounds to me like the objects are a stored in a variable, each time
the same variable that the var in question is assigned by reference
(this is done in php4 code quite a bit so that objects that are
passed around are not copied - which makes them useless in many instances)

the following code mkight help you to understand what it is (that I think)
is happening:

// php4 compatible class
class Foo { var $s; function Foo($s) { $this-s = $s; } };

$store = array();
$var   = new Foo(A);
$store[A] = $var;
$var   = new Foo(B);
$store[B] = $var;
$var   = new Foo(C);
$store[C] = $var;

var_dump($store);

 
 This does not consistently happen, only under particular circumstances
 (it seems to be a certain set of elements in $_SESSION triggers it).
 For instance, if I unset $_SESSION['b'] * prior* to doing
 session_write_close() - the behaviour stops, and the elements are
 retained. Has anybody seen this before?
 
 
 Vital Stats:
 
 PHP5.2
 Apache1.3
 FastCGI
 Sessions are stored using PHP5's default session handling.
 
 Thanks in advance
 


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



[PHP] Reports generator

2010-01-26 Thread PEPITOVADECURT

Exists any reports generator that exports directly to html/php?


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



Re: [PHP] SQL question

2010-01-26 Thread tedd

At 9:54 PM -0600 1/25/10, Skip Evans wrote:

Hey all,

I have an SQL query that's stumping me.

I have two date variables, $start and $end that are in mm/dd/ 
format and two database fields, start_date and no_donations. The 
start date is mm/dd/ format and no_donations is an integer that 
represents the number of months from start_date that donations will 
be made.


So if start date is say 02/01/2010 and no_dations is 4 then 
donations will be made four times from the start date for four 
months.


What I need to do is come up with a query that will determine if the 
start_date + no_donations falls within $start and $end.


But I'm pretty stumped. How can I convert start_date + no_donations 
in the database to the date when the last donation will take place 
so I'll now if the donations fall between $start and $end?


Any suggestions would be very help and appreciated,
Skip

--

Skip Evans


Skip:

Here's a snip-it of code from one of my projects:

$qry = SELECT SUM(amount) AS subtotal, COUNT(*) AS num
FROM transaction 
WHERE product_type = 'video'

AND UNIX_TIMESTAMP(transtime)   . strtotime($startd) . 
AND UNIX_TIMESTAMP(transtime)   . strtotime($endd) . 
AND is_charged = 1
AND notes = 'Approved'
AND is_refunded = 0
AND transnum NOT LIKE 'TEST-PNREF'
AND product_id LIKE '$key' ;
$db2-select($qry);
while ($db2-readrow())
{
	$rev = $db2-data[subtotal];	// this is the total amount 
collected for the sale
	$num = $db2-data[num];		// this is the number 
of this type of sale

}

Clearly, you don't need everything there, but the timestamp notation 
will give you better insight into how to use dates in your query.


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] hola mundo

2010-01-26 Thread PEPITOVADECURT

Hola


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



Re: [PHP] SQL question

2010-01-26 Thread Kim Madsen

Michael A. Peters wrote on 26/01/2010 06:04:

I use seconds from epoch in the database simply because it works so well 
with the php date() function.


If you need something where Julian day really is better, I assume it 
isn't that hard to convert between posix and julian day, though it seems 
odd to me that it isn't part of the date() function. It probably should be.


When I do date comparisons in MySQL I use the to_days() function.

 What I need to do is come up with a query that will determine if the 
start_date + no_donations falls within $start and $end.


In the given example one could determine that a month is always 30 days 
and then say to_days(start_date)+(no_donations*30)  to_days(end). This 
would however be a very loose method. You could go for finding the 
number of days in the current month and substract that (10th. = 30-10), 
play with MySQLs left() function


But Skip, as the others say, use a date class, since you're passing a 
php var on to the SQL anyway, then you could determine the exact days 
from start to end of donation. Combine this with to_days and you have 
your solution


--
Kind regards
Kim Emax - masterminds.dk

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



[PHP] DirectoryIterator

2010-01-26 Thread Christoph Boget
I've looked through the docs but was unable to find out if this is possible;
I hope it is.  Is there a way that you get the size/length of the collection
to be iterated (e.g. the total number of files) without having to iterate
through at least once?

thnx,
Christoph


Re: [PHP] DirectoryIterator

2010-01-26 Thread Nathan Nobbe
On Tue, Jan 26, 2010 at 1:17 PM, Christoph Boget cbo...@hotmail.com wrote:

 I've looked through the docs but was unable to find out if this is
 possible;
 I hope it is.  Is there a way that you get the size/length of the
 collection
 to be iterated (e.g. the total number of files) without having to iterate
 through at least once?


def not on DirectorIterator afaik, and furthermore, i dont think thats
supported at the shell / filesystem level even.

-nathan


Re: [PHP] DirectoryIterator

2010-01-26 Thread Christoph Boget

 def not on DirectorIterator afaik, and furthermore, i dont think thats
 supported at the shell / filesystem level even.


Well if the Iterator has the whole of the collection in order to be able to
iterate over it, I would think that it should be able to return the size of
that collection... :(

thnx,
Christoph


Re: [PHP] DirectoryIterator

2010-01-26 Thread Ashley Sheridan
On Tue, 2010-01-26 at 15:25 -0500, Christoph Boget wrote:

 
  def not on DirectorIterator afaik, and furthermore, i dont think thats
  supported at the shell / filesystem level even.
 
 
 Well if the Iterator has the whole of the collection in order to be able to
 iterate over it, I would think that it should be able to return the size of
 that collection... :(
 
 thnx,
 Christoph


Surely by that point it's already iterated at least once to put that
collection together?

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




Re: [PHP] DirectoryIterator

2010-01-26 Thread Nathan Nobbe
On Tue, Jan 26, 2010 at 1:25 PM, Christoph Boget cbo...@hotmail.com wrote:

 
  def not on DirectorIterator afaik, and furthermore, i dont think thats
  supported at the shell / filesystem level even.


 Well if the Iterator has the whole of the collection in order to be able to
 iterate over it, I would think that it should be able to return the size of
 that collection... :(


right but the collection is built during iteration.  one thing you could do
if you wanted it to *appear* as though the count was there at construction
is to subclass and iterate once in the constructor.

something like this:

?php
class SmartDirectoryIterator extends DirectoryIterator implements Countable
{
  private $_iCount = 0;

  public function __construct($sPath)
  {
parent::__construct($sPath);
foreach($this as $oFile)
  if($oFile-isFile())
$this-_iCount++;
  }

  public function count()
  {
return $this-_iCount;
  }
?

-nathan


Re: [PHP] DirectoryIterator

2010-01-26 Thread Christoph Boget

 right but the collection is built during iteration.


So you're saying that if I add a file to the directory between the time I
instantiate the DirectoryIterator and the time I'm finished iterating
through, that file could be picked up?  Or is the instance only going to
contain a list of files in that directory at the time the object was
constructed?

thnx,
Christoph


Re: [PHP] DirectoryIterator

2010-01-26 Thread Kim Madsen

Christoph Boget wrote on 26/01/2010 21:17:

I've looked through the docs but was unable to find out if this is possible;
I hope it is.  Is there a way that you get the size/length of the collection
to be iterated (e.g. the total number of files) without having to iterate
through at least once?


On Linux with safe mode off you can call system(du -hcs THE_DIR) to 
get the size of all files, no iterations needed.


Number of files could be a find command piped into wc -l, called from 
system(), like find . -name * | wc -l (but that would count dirs aswell)


--
Kind regards
Kim Emax - masterminds.dk

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



Re: [PHP] DirectoryIterator

2010-01-26 Thread Christoph Boget
I executed the following test script several times.  Each time, in a
separate terminal window, I ran touch bob.txt after the script started
echoing out.  After the script completed, I deleted bob.txt.  During each
execution, not once did bob.txt show up in the output.  This makes me
believe that the file collection that DirectoryIterator is going to work
with is set at instantiation.  If that's the case, it makes little sense to
me that you are unable to get the size of that collection from the
DirectoryInterator object.

?php
  $dirList = new DirectoryIterator(MY_DIR);
  foreach($dirList as $file )
  {
echo $file-getFilename() . 'br';
flush();
sleep( 1 );
  }
?

thnx,
Christoph


Re: [PHP] DirectoryIterator

2010-01-26 Thread Nathan Nobbe
On Tue, Jan 26, 2010 at 2:05 PM, Christoph Boget cbo...@hotmail.com wrote:

 I executed the following test script several times.  Each time, in a
 separate terminal window, I ran touch bob.txt after the script started
 echoing out.  After the script completed, I deleted bob.txt.  During each
 execution, not once did bob.txt show up in the output.  This makes me
 believe that the file collection that DirectoryIterator is going to work
 with is set at instantiation.  If that's the case, it makes little sense to
 me that you are unable to get the size of that collection from the
 DirectoryInterator object.

 ?php
  $dirList = new DirectoryIterator(MY_DIR);
  foreach($dirList as $file )
  {
echo $file-getFilename() . 'br';
flush();
sleep( 1 );
  }
 ?


in that case you would likely need to expose something extra from the C
layer.

-nathan


Re: [PHP] DirectoryIterator

2010-01-26 Thread Nathan Nobbe
On Tue, Jan 26, 2010 at 2:01 PM, Kim Madsen php@emax.dk wrote:

 Christoph Boget wrote on 26/01/2010 21:17:

  I've looked through the docs but was unable to find out if this is
 possible;
 I hope it is.  Is there a way that you get the size/length of the
 collection
 to be iterated (e.g. the total number of files) without having to iterate
 through at least once?


 On Linux with safe mode off you can call system(du -hcs THE_DIR) to get
 the size of all files, no iterations needed.


right, thats the size, not a count of them.


 Number of files could be a find command piped into wc -l, called from
 system(), like find . -name * | wc -l (but that would count dirs aswell)


right, so on linux, you need to iterate over the filesystem to get a count
(unless someone knows a magic command the os / shell provides which returns
this info in a single call).

-nathan


Re: [PHP] DirectoryIterator

2010-01-26 Thread Nathan Nobbe
On Tue, Jan 26, 2010 at 2:06 PM, Nathan Nobbe quickshif...@gmail.comwrote:

 On Tue, Jan 26, 2010 at 2:05 PM, Christoph Boget cbo...@hotmail.comwrote:

 I executed the following test script several times.  Each time, in a
 separate terminal window, I ran touch bob.txt after the script started
 echoing out.  After the script completed, I deleted bob.txt.  During each
 execution, not once did bob.txt show up in the output.  This makes me
 believe that the file collection that DirectoryIterator is going to work
 with is set at instantiation.  If that's the case, it makes little sense
 to
 me that you are unable to get the size of that collection from the
 DirectoryInterator object.

 ?php
  $dirList = new DirectoryIterator(MY_DIR);
  foreach($dirList as $file )
  {
echo $file-getFilename() . 'br';
flush();
sleep( 1 );
  }
 ?


 in that case you would likely need to expose something extra from the C
 layer.


fwiw.., a quick peak at the code reveals the following:

. in the DirectoryIterator constructor it looks like the directory is
iterated at the C level

/* {{{ proto void DirectoryIterator::__construct(string path)
 Cronstructs a new dir iterator from a path. */
SPL_METHOD(DirectoryIterator, __construct)
{
/*  */
spl_filesystem_dir_open(intern, path TSRMLS_CC);
/*  */
}
/* }}} */


. this iteration is implemented in some php stream code, but it looks like
some internal C structures are tracking the file count

PHPAPI int _php_stream_scandir(char *dirname, char **namelist[], int flags,
php_stream_context *context,
  int (*compare) (const char **a, const char **b) TSRMLS_DC)

{

/* im pretty sure this is where the number of files is stored .. */


int nfiles = 0;



/* read rest of function in main/streams/streams.c */
}

-nathan


Re: [PHP] DirectoryIterator

2010-01-26 Thread Paul M Foster
On Tue, Jan 26, 2010 at 10:01:12PM +0100, Kim Madsen wrote:

 Christoph Boget wrote on 26/01/2010 21:17:
 I've looked through the docs but was unable to find out if this is
 possible;
 I hope it is.  Is there a way that you get the size/length of the
 collection
 to be iterated (e.g. the total number of files) without having to iterate
 through at least once?

 On Linux with safe mode off you can call system(du -hcs THE_DIR) to
 get the size of all files, no iterations needed.

This assumes the du command is available on the host system. Check
first to make sure.

Paul

-- 
Paul M. Foster

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



RE: [PHP] If the first four characters are 0000, then do {} - timing tests

2010-01-26 Thread Daevid Vincent
 

 -Original Message-
 From: paras...@gmail.com [mailto:paras...@gmail.com] On 
 Behalf Of Daniel Brown
 Sent: Tuesday, January 26, 2010 8:21 AM
 To: Daevid Vincent
 Cc: John Taylor-Johnston; PHP-General
 Subject: Re: [PHP] If the first four characters are , then do {}
 
 On Mon, Jan 25, 2010 at 22:51, Daevid Vincent 
 dae...@daevid.com wrote:
  -Original Message-
  From: paras...@gmail.com [mailto:paras...@gmail.com] On
  Behalf Of Daniel Brown
  Sent: Monday, January 25, 2010 6:43 PM
  To: John Taylor-Johnston
  Cc: PHP-General
  Subject: Re: [PHP] If the first four characters are 
 , then do {}
 
  On Mon, Jan 25, 2010 at 21:36, John Taylor-Johnston
  john.taylor-johns...@cegepsherbrooke.qc.ca wrote:
   I am reading the manual: 
 http://ca.php.net/manual/en/ref.strings.php
  
   $mydata-restored = -00-00;
 
  ?php
 
  $o[] = '0942-23-23';
  $o[] = '-00-00';
  $o[] = '1238-00-00';
  $o[] = '0001-23-45';
  $o[] = '-11-22';
 
  for($i=0;$icount($o);$i++) {
          if(preg_match('/^[0]{4,}\-/U',$o[$i])) {
                  echo Offset #.$i. matches: .$o[$i].PHP_EOL;
          }
  }
  ?
 
  Holy macaroni. Talk about overkill!
 
  if (substr($mydata-restored,0,4) == ) { }
 
 Overkill?
 
 ?php
 
 $o[] = '0942-23-23';
 $o[] = '-00-00';
 $o[] = '1238-00-00';
 $o[] = '0001-23-45';
 $o[] = '-11-22';
 
 $now = microtime();
 
 for($i=0;$icount($o);$i++) {
if(preg_match('/^[0]{4,}\-/U',$o[$i])) {
//echo Offset #.$i. matches: .$o[$i].PHP_EOL;
}
 }
 
 echo (microtime(1) - $now).\n;
 
 
 $later = microtime();
 
 for($i=0;$icount($o);$i++) {
 if(substr($o[$i],0,4) == ) {
 //echo Offset #.$i. matches: .$o[$i].PHP_EOL;
 }
 }
 
 echo (microtime(1) - $later).\n;
 
 ?
 
  Sample Output:
 
 1264522257.0001
 1264522257
 
 The preg_match() method, which is more expandable and adaptable
 than relying on static position, took less than one-ten-thousandths of
 a second longer to calculate than substr().

Well allow me to retort... :)

Your test was for 5 measly array elements.

Just for SG I tried it with the strpos one too and modified your test
slightly to handle bigger arrays...

?php
for ($i = 0; $i  100; $i++ )
$o[] =
sprintf('%04d-%02d-%02d',rand(,),rand(00,99),rand(00,99));
#print_r($o);
echo array of .number_format($i).\n;
###
$now = microtime(true);
for($i=0;$icount($o);$i++) {
   if(preg_match('/^[0]{4,}\-/U',$o[$i])) {
   //echo Offset #.$i. matches: .$o[$i].PHP_EOL;
   }
}
$rank['preg_match'] = (microtime(true) - $now);
###
$later = microtime(true);
for($i=0;$icount($o);$i++) {
if(substr($o[$i],0,4) == ) {
//echo Offset #.$i. matches: .$o[$i].PHP_EOL;
}
}
$rank['substr'] = (microtime(true) - $later);
###
$after = microtime(true);
for($i=0;$icount($o);$i++) {
if(strpos($o[$i], '') === 0) {
//echo Offset #.$i. matches: .$o[$i].PHP_EOL;
}
}
$rank['strpos'] = (microtime(true) - $after);
###
asort($rank);
print_r($rank);
?

array of 10,000
Array
(
[strpos] = 0.00766682624817
[substr] = 0.0116670131683
[preg_match] = 0.0124950408936
)

array of 100,000
Array
(
[strpos] = 0.0817799568176
[substr] = 0.120522975922
[preg_match] = 0.125612974167
)

array of 1,000,000
Array
(
[strpos] = 0.805890083313
[substr] = 1.1975422
[preg_match] = 1.25615906715
)

I ran out of memory with more than 1M array elements.

But yes, I will concede that the speed difference is minimal, even at 1M
elements. Although the docs are right that strpos is about 2x as fast...

 Just an FYI before you start worshipping pasta, Mr. Vincent.  ;-P

By the way, I loved your book Da Vinci Code ;-p


ÐÆ5ÏÐ
http://daevid.com

Ezekiel 25:17. The path of the righteous man is beset on all sides by the
inequities of the selfish and the tyranny of evil men. Blessed is he who,
in the name of charity and good will, shepherds the weak through the valley
of the darkness. For he is truly his brother's keeper and the finder of
lost children. And I will strike down upon thee with great vengeance and
furious anger those who attempt to poison and destroy my brothers. And you
will know I am the Lord when I lay my vengeance upon you!


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



Re: [PHP] If the first four characters are 0000, then do {} - timing tests

2010-01-26 Thread Daniel Brown
On Tue, Jan 26, 2010 at 17:17, Daevid Vincent dae...@daevid.com wrote:

 Well allow me to retort... :)

 Your test was for 5 measly array elements.

 Just for SG I tried it with the strpos one too and modified your test
 slightly to handle bigger arrays...

[snip=code]

 I ran out of memory with more than 1M array elements.

 But yes, I will concede that the speed difference is minimal, even at 1M
 elements. Although the docs are right that strpos is about 2x as fast...

Right.  I removed the note you posted to that effect a few moments
ago because you didn't explain what was being done.  If you'll
resubmit it with a snippet of the conversation (or even just, in
discussions about benchmarks with this vs. that vs. those, blah, blah,
blah) it'll stay up.  It's a good test result, and worthwhile for
those building large-scale systems.  Kudos to you, Doctor!  ;-P

     Just an FYI before you start worshipping pasta, Mr. Vincent.  ;-P

 By the way, I loved your book Da Vinci Code ;-p

I was always too busy writing it to read it.

-- 
/Daniel P. Brown
daniel.br...@parasane.net || danbr...@php.net
http://www.parasane.net/ || http://www.pilotpig.net/
Looking for hosting or dedicated servers?  Ask me how we can fit your budget!

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



[PHP] Strange behaviour with str_ireplace()

2010-01-26 Thread Angus Mann
Hi all. I found some unexpected behaviour with str_ireplace.

To summarize, if the $replace term is a number, but formatted as currency with 
trailing zero's (34.50) the function drops the trailing zero.

Example :

$price=34.5;
$message=You owe me #amount#.;
$message1 = str_ireplace(#amount#,sprintf(%01.2f,$price),$message);
$message2 = str_ireplace(#amount#,$.sprintf(%01.2f,$price),$message);


$message1 will yield You owe me 34.4
$message2 will yield You owe me $34.40

So in other words, if the replace term can be interpreted as a number, it will 
be, including truncation of zero's.
I didn't expect this, because as the function name suggests, it's a *string* 
replace.

Fortunately I can just add a $ to the amount and make it work as a string, not 
a number but this would not always be the case.

Is this by design, or is it a bug?



Re: [PHP] Strange behaviour with str_ireplace()

2010-01-26 Thread Angus Mann

Grrr...please ignore.

After battling with this for a while I now can't reproduce the problem.

Apologies for an un-necessary post.

- Original Message - 
From: Angus Mann angusm...@pobox.com

To: PHP-General php-general@lists.php.net
Sent: Wednesday, January 27, 2010 9:02 AM
Subject: [PHP] Strange behaviour with str_ireplace()


Hi all. I found some unexpected behaviour with str_ireplace.

To summarize, if the $replace term is a number, but formatted as currency 
with trailing zero's (34.50) the function drops the trailing zero.


Example :

$price=34.5;
$message=You owe me #amount#.;
$message1 = str_ireplace(#amount#,sprintf(%01.2f,$price),$message);
$message2 = str_ireplace(#amount#,$.sprintf(%01.2f,$price),$message);


$message1 will yield You owe me 34.4
$message2 will yield You owe me $34.40

So in other words, if the replace term can be interpreted as a number, it 
will be, including truncation of zero's.
I didn't expect this, because as the function name suggests, it's a *string* 
replace.


Fortunately I can just add a $ to the amount and make it work as a string, 
not a number but this would not always be the case.


Is this by design, or is it a bug?



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



Re: [PHP] Speed of sending email .. can I put them in a queue rather than wait?

2010-01-26 Thread Manuel Lemos
Hello,

On Tue, Jan 26, 2010 at 12:02 PM, Angus Mann angusm...@pobox.com wrote:
 I'm currently using the phpmailer class from phpmailer.worxware.com to
 send datatbase -populated emails to clients.

 At the moment I'm runninng PHP on Windows and using the built-in sendmail
 equivalent packaged with XAMPP. It uses a remote SMTP that authenticates by
 prior logging into a POP account.

 The number of emails sent is very small. Each one is only sent after a user
 fills out a form and presses send.

 But there is a noticable lag of about 5 or sometimes 10 seconds after
 pressing send before the user sees the Mail sent page. I presume the
 reason for the lag is the time spent logging on and off a remote POP, then
 SMTP server, transferring the data etc.

 It would be better if this happened in the background - that is, the user
 could get on with doing his next task while the emails sat in a queue in the
 backgorund, being lined up and sent without PHP waiting for the process to
 finish.

 Can anybody recommend a good way of doing this? Is Mercury Mail going to
 help me here?

The problem is that you are using Windows. Windows is a weak platform
for what you are doing as it lacks of free solutions like those you find
in Linux or any other Unix like OS.

Under Linux practically every MTA has a queue. All MTAs queue messages
by default instead of sending the message right away, except for sendmail.

That is way faster than having your application to send messages to your
MTA by SMTP as you are doing.

If you are really stuck with Windows, if you can use Microsoft Exchange,
you may use a faster solution. Exchange has a local pickup queue
directory. You just write messages in that directory and leave them
there. PHP does not need to wait for any delivery. Exchange will pickup
the messages ASAP and deliver them.

This is explained in this presentation. Jump to slide 11.

http://www.phpclasses.org/browse/video/3/package/9.html

If you want to use this solution, the MIME message package has a driver
class for queueing messages in Exchange pickup queue directory . Take a
look at the test_pickup_message.php example script.


http://www.phpclasses.org/mimemessage


-- 

Regards,
Manuel Lemos

Find and post PHP jobs
http://www.phpclasses.org/jobs/

PHP Classes - Free ready to use OOP components written in PHP
http://www.phpclasses.org/

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



[PHP] Do you use a public framework or roll your own?

2010-01-26 Thread Daevid Vincent
 
I'm not looking to start a holy war here or re-hash the tired debate. 
I just want some hard cold numbers to look at.

Do you use a public framework or roll your own?
http://www.rapidpoll.net/8opnt1e


And for those interested, here are the results of the last poll:

To add the final ? in PHP or not...
http://www.rapidpoll.net/show.aspx?id=arc1opy

I'm relieved to know I'm in the majority (almost 2:1) who close their
opening PHP tags. :)


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



Re: [PHP] Do you use a public framework or roll your own?

2010-01-26 Thread Ashley Sheridan
On Tue, 2010-01-26 at 16:17 -0800, Daevid Vincent wrote:

 I'm not looking to start a holy war here or re-hash the tired debate. 
 I just want some hard cold numbers to look at.
 
 Do you use a public framework or roll your own?
 http://www.rapidpoll.net/8opnt1e
 
 
 And for those interested, here are the results of the last poll:
 
 To add the final ? in PHP or not...
 http://www.rapidpoll.net/show.aspx?id=arc1opy
 
 I'm relieved to know I'm in the majority (almost 2:1) who close their
 opening PHP tags. :)
 
 


When you ay roll your own, what do you define a framework as? Do you
class it as something as big and complex as a fully-fledged MVC
framework, or would a collection of modules you've put together over
time satisfy this?

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




Re: [PHP] If the first four characters are 0000, then do {} - timing tests

2010-01-26 Thread shiplu
Ran this code (http://pastie.org/795983)
The result is,

array of 10,000
Array
(
[[]] = 5.66168689728
[strpos] = 5.70796895027
[substr] = 5.92751288414
[preg_match] = 6.21515512466
)





-- 
Shiplu Mokaddim
My talks, http://talk.cmyweb.net
Follow me, http://twitter.com/shiplu
SUST Programmers, http://groups.google.com/group/p2psust
Innovation distinguishes bet ... ... (ask Steve Jobs the rest)

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



Re: [PHP] Do you use a public framework or roll your own?

2010-01-26 Thread James McLean
On Wed, Jan 27, 2010 at 10:47 AM, Daevid Vincent dae...@daevid.com wrote:

 I'm not looking to start a holy war here or re-hash the tired debate.
 I just want some hard cold numbers to look at.

 Do you use a public framework or roll your own?
 http://www.rapidpoll.net/8opnt1e

I have rolled my own in the past in the time before Zend Framework
(and others) and I was quite proud of it to be honest. It was MVC
based with PHPTal templates and I used a lot of concepts I learned
from a hardcore Java developer when building it. I tweaked and refined
it to a point where I was very very happy with its performance (I used
it for my performance benchmarking as part of my presentation on APC
at OSDC Sydney 2008) and was intending to roll it out to power a
commercial project of mine. Didn't happen as I planned, however I
still have the codebase. I wrote it when I was rather new to OOP so it
has undergone quite a bit of refactoring over time.

I may open source it now that I have no major plans for it, perhaps
someone may find the code useful in some way shape or form. Includes a
rather simple ORM that ties into APC with it's variable caching
abilities (I am aware of the limitations this provides now),
reasonably simple MVC concepts and the ability to run multiple
websites  domains from a single installation. Other basics are there
like XML reading etc etc.

In hindsight, it's a little clunky now. But I was proud of it and I
still am to a point :) Personally I believe any PHP developer who
wants to be taken seriously should have written thier own framework :)

I am actually planning another project, however it will use Zend
Framework as a base. No need to re-invent the wheel, again, as fun as
it would be :)

Cheers

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



RE: [PHP] If the first four characters are 0000, then do {} - timing tests

2010-01-26 Thread Daevid Vincent
 -Original Message-
 From: muquad...@gmail.com [mailto:muquad...@gmail.com] On 
 Behalf Of shiplu
 Sent: Tuesday, January 26, 2010 4:25 PM
 To: Daniel Brown
 Cc: Daevid Vincent; PHP-General
 Subject: Re: [PHP] If the first four characters are , 
 then do {} - timing tests
 
 Ran this code (http://pastie.org/795983)

+1 for using pastie.org. :)

 The result is,
 
 array of 10,000
 Array
 (
 [[]] = 5.66168689728
 [strpos] = 5.70796895027
 [substr] = 5.92751288414
 [preg_match] = 6.21515512466
 )

Almost 6 seconds to sort 10k array elements! Are you running this on a
Commodore64 ?!

Not that it probably matters, but I thought that it should be $o[$i]{0}
through $o[$i]{3} 
Note the use of braces not square brackets for string character elements,
no?

Another thing I just noticed, is that we (that is Dan and I) should NOT
have used count()
This is bad form and wasted cycles.

for($i=0;$icount($o);$i++)

We should have just done a $elements = count($o) at the VERY top and used
$elements instead.

Does anyone know how PHP works internally? If I have 1M elements in the
array, does count() literally just zip through and $i++ them, or is there
some shortcut tally kept in the heap/stack/struct/memory somewhere for each
array?

Updated version:

?php
for ($elements = 0; $elements  100; $elements++ )
$o[] =
sprintf('%04d-%02d-%02d',rand(,),rand(00,99),rand(00,99));
#print_r($o);
echo array of .number_format($elements).\n;
###
$time = microtime(true);
for($i=0;$i$elements;$i++) {
   if(preg_match('/^[0]{4,}\-/U',$o[$i])) {
   //echo Offset #.$i. matches: .$o[$i].PHP_EOL;
   }
}
$rank['preg_match'] = (microtime(true) - $time);
###
$time = microtime(true);
for($i=0;$i$elements;$i++) {
if(substr($o[$i],0,4) == ) {
//echo Offset #.$i. matches: .$o[$i].PHP_EOL;
}
}
$rank['substr'] = (microtime(true) - $time);
###
$time = microtime(true);
for($i=0;$i$elements;$i++) {
if(strpos($o[$i], '') === 0) {
//echo Offset #.$i. matches: .$o[$i].PHP_EOL;
}
}
$rank['strpos'] = (microtime(true) - $time);
###
$time = microtime(true);
for($i=0;$i$elements;$i++) {
if($o[$i][0]==='0'
 $o[$i][1]==='0'
 $o[$i][2]==='0'
 $o[$i][3]==='0'
   ) {
   //echo Offset #.$i. matches: .$o[$i].PHP_EOL;
   }
}
$rank['[]'] = (microtime(true) - $time);
###
asort($rank);
print_r($rank);
?

array of 10,000
Array
(
[[]] = 0.00380492210388
[strpos] = 0.0054030418396
[substr] = 0.00824618339539
[preg_match] = 0.0103938579559
)

array of 1,000,000  (ran three times)
(
[[]] = 0.4429500103
[strpos] = 0.549595832825
[substr] = 0.847616195679
[preg_match] = 0.94566321373
)
(
[[]] = 0.420958995819
[strpos] = 0.55828499794
[substr] = 0.86266708374
[preg_match] = 0.933307886124
)
(
[[]] = 0.420862197876
[strpos] = 0.572381019592
[substr] = 0.855034828186
[preg_match] = 0.932211875916
)

Notice that without the 'count()' it is significantly faster than before...

array of 1,000,000
Array
(
[strpos] = 0.805890083313
[substr] = 1.1975422
[preg_match] = 1.25615906715
)


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



Re: [PHP] Do you use a public framework or roll your own?

2010-01-26 Thread Michael A. Peters

Daevid Vincent wrote:
 
I'm not looking to start a holy war here or re-hash the tired debate. 
I just want some hard cold numbers to look at.


Do you use a public framework or roll your own?
http://www.rapidpoll.net/8opnt1e


And for those interested, here are the results of the last poll:

To add the final ? in PHP or not...
http://www.rapidpoll.net/show.aspx?id=arc1opy

I'm relieved to know I'm in the majority (almost 2:1) who close their
opening PHP tags. :)




I roll my own, partially from classes I wrote and partially from classes 
at phpclasses.org and partially from neat stuff I find on the web.


Not sure you could call it framework though, just a loose collection of 
independent classes.


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



RE: [PHP] Do you use a public framework or roll your own?

2010-01-26 Thread Daevid Vincent
 

 -Original Message-
 From: Ashley Sheridan [mailto:a...@ashleysheridan.co.uk] 
 Sent: Tuesday, January 26, 2010 4:18 PM
 
 On Tue, 2010-01-26 at 16:17 -0800, Daevid Vincent wrote:
 
  I'm not looking to start a holy war here or re-hash the 
  tired debate. I just want some hard cold numbers to look at.
  
  Do you use a public framework or roll your own?
  http://www.rapidpoll.net/8opnt1e
 
 When you ay roll your own, what do you define a framework as? Do you
 class it as something as big and complex as a fully-fledged MVC
 framework, or would a collection of modules you've put together over
 time satisfy this?

Well for me, it's exactly as you say. It's a collection of functions,
base.class.php (with magic __set(), __call(), __get(), debug introspection,
etc.), User.class.php (loading, saving, logging, roles, etc.),
$_SESSION['user'], gui_nav.inc.php, gui_menu.inc.php, gui_footer.inc.php,
gui_header.inc.php, db.inc.php wrapper functions, global.inc.php, and a few
other 'function' collections for time/date, XML, outputting a standardized
HTML table with rollover/headings/popups/row summary/etc, select box
(multi, blank option, ghosted options, array/sql, etc). logic I've
accumulated over the years of what works and what doesn't.

So at each company, I tend to start with my previous framework and build
upon it. Improving it. Tweeking and optimizing it not only for future use,
but also for the specific task at hand. Ripping out things that don't apply
to keep the code lean and adding routines that help make life easier too.
For example, until this current job, I would never have used a
print_table() routine that takes arrays of headings (tooltips optional),
rows, data and prints out an HTML table because I thought it was a waste of
memory and I can just loop and do it in each page. But now I am kicking
myself for not doing that in other companies. Sure it has some gotchas,
but I've worked through pretty much every one so far and this routine kicks
some ass up and down the block. It even exports to Excel, WITH notes =
tooltips. Yeah baby!

I tried Symfony at one company and absolutely hated it. I hear good things
about Zend. But overall -- and again, I really do NOT want this to turn
into a debate or the pros/cons, I just wanted to know some percentages of
what people are REALLY using. Partially curiosity and partially to maybe
re-consider or maybe to re-enforce what I've been doing.


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



RE: [PHP] Do you use a public framework or roll your own?

2010-01-26 Thread Ashley Sheridan
On Tue, 2010-01-26 at 17:01 -0800, Daevid Vincent wrote:

 
  -Original Message-
  From: Ashley Sheridan [mailto:a...@ashleysheridan.co.uk] 
  Sent: Tuesday, January 26, 2010 4:18 PM
  
  On Tue, 2010-01-26 at 16:17 -0800, Daevid Vincent wrote:
  
   I'm not looking to start a holy war here or re-hash the 
   tired debate. I just want some hard cold numbers to look at.
   
   Do you use a public framework or roll your own?
   http://www.rapidpoll.net/8opnt1e
  
  When you ay roll your own, what do you define a framework as? Do you
  class it as something as big and complex as a fully-fledged MVC
  framework, or would a collection of modules you've put together over
  time satisfy this?
 
 Well for me, it's exactly as you say. It's a collection of functions,
 base.class.php (with magic __set(), __call(), __get(), debug introspection,
 etc.), User.class.php (loading, saving, logging, roles, etc.),
 $_SESSION['user'], gui_nav.inc.php, gui_menu.inc.php, gui_footer.inc.php,
 gui_header.inc.php, db.inc.php wrapper functions, global.inc.php, and a few
 other 'function' collections for time/date, XML, outputting a standardized
 HTML table with rollover/headings/popups/row summary/etc, select box
 (multi, blank option, ghosted options, array/sql, etc). logic I've
 accumulated over the years of what works and what doesn't.
 
 So at each company, I tend to start with my previous framework and build
 upon it. Improving it. Tweeking and optimizing it not only for future use,
 but also for the specific task at hand. Ripping out things that don't apply
 to keep the code lean and adding routines that help make life easier too.
 For example, until this current job, I would never have used a
 print_table() routine that takes arrays of headings (tooltips optional),
 rows, data and prints out an HTML table because I thought it was a waste of
 memory and I can just loop and do it in each page. But now I am kicking
 myself for not doing that in other companies. Sure it has some gotchas,
 but I've worked through pretty much every one so far and this routine kicks
 some ass up and down the block. It even exports to Excel, WITH notes =
 tooltips. Yeah baby!
 
 I tried Symfony at one company and absolutely hated it. I hear good things
 about Zend. But overall -- and again, I really do NOT want this to turn
 into a debate or the pros/cons, I just wanted to know some percentages of
 what people are REALLY using. Partially curiosity and partially to maybe
 re-consider or maybe to re-enforce what I've been doing.
 
 


I think then from what you've said, that I guess I do use a sort of
loose framework of my own bits I've put together. I havn't had quite so
long as it sounds you've had to put them together (I'm not trying to age
bash :p ) so I've still got plenty to learn, but it does help me work
smarter when I'm putting things together.

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





Re: [PHP] Speed of sending email .. can I put them in a queue rather than wait?

2010-01-26 Thread Jim Lucas
Manuel Lemos wrote:
 Hello,
 
 On Tue, Jan 26, 2010 at 12:02 PM, Angus Mann angusm...@pobox.com wrote:
 I'm currently using the phpmailer class from phpmailer.worxware.com to
 send datatbase -populated emails to clients.

 At the moment I'm runninng PHP on Windows and using the built-in sendmail
 equivalent packaged with XAMPP. It uses a remote SMTP that authenticates by
 prior logging into a POP account.

 The number of emails sent is very small. Each one is only sent after a user
 fills out a form and presses send.

 But there is a noticable lag of about 5 or sometimes 10 seconds after
 pressing send before the user sees the Mail sent page. I presume the
 reason for the lag is the time spent logging on and off a remote POP, then
 SMTP server, transferring the data etc.

 It would be better if this happened in the background - that is, the user
 could get on with doing his next task while the emails sat in a queue in the
 backgorund, being lined up and sent without PHP waiting for the process to
 finish.

 Can anybody recommend a good way of doing this? Is Mercury Mail going to
 help me here?
 
 The problem is that you are using Windows. Windows is a weak platform
 for what you are doing as it lacks of free solutions like those you find
 in Linux or any other Unix like OS.
 
 Under Linux practically every MTA has a queue. All MTAs queue messages
 by default instead of sending the message right away, except for sendmail.
 
 That is way faster than having your application to send messages to your
 MTA by SMTP as you are doing.
 

I agree that using a local MTA is somewhat faster then using a remote SMTP
server, but I would have to say that the performance issue that he is reporting
would be noticed by all that used remote SMTP servers if it were such a
significant difference.

I would argue that he needs to audit his code a little more.  What he said was
that the entire process from hitting the send button to showing the Mail sent
page took that long.  He said I presume the reason for the lag is the time
spent logging on and off a remote POP, then SMTP server, transferring the data
etc.  I would suggest that he find out if it is or not.  I would like to see
proof that it is this portion of the script that is causing the slowness before
 suggest he change his server platform.

He mentioned pulling data from a DB and generating the email dynamically.  Maybe
it is the DB that is causing some lag because of a badly structured SQL call.
Maybe it has to do with the size of the data that he is requesting from the DB.

Could it be the amount of data that he is submitting through the form?

I would suggest that he try and replicate the process with the simplest of code.
 Even as far as removing the DB portion and sending hard coded data instead of
stuff pulled from the db.

Simply enough, I would have many things that I would suggest trying before
telling someone to replace their OS.

Just my 2cents...

 If you are really stuck with Windows, if you can use Microsoft Exchange,
 you may use a faster solution. Exchange has a local pickup queue
 directory. You just write messages in that directory and leave them
 there. PHP does not need to wait for any delivery. Exchange will pickup
 the messages ASAP and deliver them.
 
 This is explained in this presentation. Jump to slide 11.
 
 http://www.phpclasses.org/browse/video/3/package/9.html
 
 If you want to use this solution, the MIME message package has a driver
 class for queueing messages in Exchange pickup queue directory . Take a
 look at the test_pickup_message.php example script.
 
 
 http://www.phpclasses.org/mimemessage
 
 


-- 
Jim Lucas
NOC Manager
541-323-9113
BendTel, Inc.
http://www.bendtel.com

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



Re: [PHP] Speed of sending email .. can I put them in a queue rather than wait?

2010-01-26 Thread Eric Lee
Hi, all

I'am doubted about installing a local mail server for just low volume
mailing.
May I ask all yours professional what do you think about it ?


Thanks in advanced.



Regards,
Eric,




 --
 Jim Lucas
 NOC Manager
 541-323-9113
 BendTel, Inc.
 http://www.bendtel.com

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




Re: [PHP] Creating an Entire .html page with PHP

2010-01-26 Thread clancy_1
On Mon, 25 Jan 2010 18:31:54 -0800, deal...@gmail.com (deal...@gmail.com) 
wrote:


On Jan 25, 2010, at 6:23 PM, Shawn McKenzie wrote:

 file_put_contents() is s much easier.

Thanks Shawn I'll check that out ...

- I see it says : This function is identical to calling fopen(),  
fwrite() and fclose() successively to write data to a file.


my newbie brain likes that!


Thanks,
deal...@gmail.com
[db-10]

In principle this is extremely simple. Take your existing procedure to generate 
the page
then:

1. $page = '';

2. Replace every echo 'whatever'; statement with $page .= 'whatever';, and 
every html
with $page .= 'html';

3. file_put_contents($page,$file) // The manual is down (again!) and I have 
forgotten the
format.

4. echo( file_get_contents($file));  // to generate the PHP page.

However I strongly suspect that it is possible to simply redirect all the 
'echo's in your
existing procedure to write to $page (or $file?), without changing the code at 
all. Is
this so?

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



Re: [PHP] Speed of sending email .. can I put them in a queue rather than wait?

2010-01-26 Thread Paul M Foster
On Wed, Jan 27, 2010 at 10:07:13AM +0800, Eric Lee wrote:

 Hi, all
 
 I'am doubted about installing a local mail server for just low volume
 mailing.
 May I ask all yours professional what do you think about it ?
 

Every place I've ever hosted (all Linux servers) include a local MTA
which is up and running. In a large hosting operation, this local MTA
probably passes the mail for relay to a central MTA somewhere else in
the host's network. There are a variety of reasons for this. Among
others, it allows the hosting company to meter email and present a
single set of credentials to foreign (offsite) mail servers. And in
general, most hosting companies provide you with the location of the
local MTA, in case you need it for Perl, Python, cron or other scripts.
And PHP's mail() function will, by default, pass email to that local
MTA. And moreover, most (all?) Linux MTAs on boxes like this don't block
while they make connections. From the OP's description, it sounded like
his phpmailer() process was blocking while it made foreign connections.

Paul

-- 
Paul M. Foster

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



Re: [PHP] Do you use a public framework or roll your own?

2010-01-26 Thread Paul M Foster
On Tue, Jan 26, 2010 at 04:17:26PM -0800, Daevid Vincent wrote:

snip

 And for those interested, here are the results of the last poll:
 
 To add the final ? in PHP or not...
 http://www.rapidpoll.net/show.aspx?id=arc1opy
 
 I'm relieved to know I'm in the majority (almost 2:1) who close their
 opening PHP tags. :)

Gosh, I can't believe so many people could be so *wrong*. ;-}

Paul

-- 
Paul M. Foster

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



RE: [PHP] Creating an Entire .html page with PHP

2010-01-26 Thread Daevid Vincent
 

 -Original Message-
 From: clanc...@cybec.com.au [mailto:clanc...@cybec.com.au] 
 Sent: Tuesday, January 26, 2010 6:09 PM
 To: php-general@lists.php.net
 Subject: Re: [PHP] Creating an Entire .html page with PHP
 
 On Mon, 25 Jan 2010 18:31:54 -0800, deal...@gmail.com 
 (deal...@gmail.com) wrote:
 
 
 On Jan 25, 2010, at 6:23 PM, Shawn McKenzie wrote:
 
  file_put_contents() is s much easier.
 
 Thanks Shawn I'll check that out ...
 
 - I see it says : This function is identical to calling fopen(),  
 fwrite() and fclose() successively to write data to a file.
 
 
 my newbie brain likes that!
 
 
 Thanks,
 deal...@gmail.com
 [db-10]
 
 In principle this is extremely simple. Take your existing 
 procedure to generate the page
 then:
 
 1. $page = '';
 
 2. Replace every echo 'whatever'; statement with $page .= 
 'whatever';, and every html
 with $page .= 'html';
 
 3. file_put_contents($page,$file) // The manual is down 
 (again!) and I have forgotten the
 format.
 
 4. echo( file_get_contents($file));  // to generate the PHP page.
 
 However I strongly suspect that it is possible to simply 
 redirect all the 'echo's in your
 existing procedure to write to $page (or $file?), without 
 changing the code at all. Is
 this so?

First of all writing pages in this old fashioned .cgi sort of way is so
1990's. Concatenating your whole page to a giant string is silly and
defeats the benefits (and purpose) of using PHP.
I'm actually in the process of porting a HUGE site from that style to a
more sane MVC and PHPish way right now. It makes me cringe every day I have
to look at 'old' code.

But instead of doing the above stuff, I suggest you look into this awesome
function.

http://us2.php.net/manual/en/function.ob-start.php

I use it to create a weekly email that can be displayed online and then use
another script to email said HTML email to users.

ob_start();
include /home/foo/public_html/weekly_email.php;
$message = ob_get_contents();
ob_end_clean();

$message will not contain all the output that weekly_email.php had

Adapt as needed to 'render' your page and store it in your $page variable
if you absolutely must do that style of coding. ...and God help you, as
it's a nightmare to work with.

d


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



Re: [PHP] Do you use a public framework or roll your own?

2010-01-26 Thread Paul M Foster
On Tue, Jan 26, 2010 at 04:17:26PM -0800, Daevid Vincent wrote:

 
 I'm not looking to start a holy war here or re-hash the tired debate.
 I just want some hard cold numbers to look at.
 
 Do you use a public framework or roll your own?
 http://www.rapidpoll.net/8opnt1e

I voted, but like others, my framework is more a collection of home
grown tools which seem to have generic applicability.

Some of this may be because I worked for many years in construction. You
get used to certain tools and the way they operate, and you prefer them.
For example, I won't use screwdrivers whose handles aren't covered with
rubber over the plastic of the handles (Stanley and Klein brands).

What I like about programming is that you get to build your own tools,
just the way you like them. ;-}

Paul

-- 
Paul M. Foster

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



[PHP] Magic Methods not working

2010-01-26 Thread Paul M Foster
I have a class which instantiates other classes, and has a magic method
like this:

function _get($classname)
{
return $this-instantiate($classname);
}

Obviously, the class also has an instantiate method which does what it
says.

Here's the problem: When I call the instantiate method, it works fine,
like this:

$db = $sc-instantiate('database');

But when I do the following, it *doesn't* work:

$db = $sc-database;

In fact it does not call the instantiate() method; I've placed a print
statement in the instantiate() method which fires at then end of the
routine. That statement doesn't fire with the above code.

The docs on magic methods are pretty slim, so I'm not sure what it is
I'm missing. Can someone enlighten me?

Paul


-- 
Paul M. Foster

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



Re: [PHP] Magic Methods not working

2010-01-26 Thread Eric Lee
On Wed, Jan 27, 2010 at 11:04 AM, Paul M Foster pa...@quillandmouse.comwrote:

 I have a class which instantiates other classes, and has a magic method
 like this:

 function _get($classname)
 {
return $this-instantiate($classname);
 }

 Obviously, the class also has an instantiate method which does what it
 says.

 Here's the problem: When I call the instantiate method, it works fine,
 like this:

 $db = $sc-instantiate('database');

 But when I do the following, it *doesn't* work:

 $db = $sc-database;

 In fact it does not call the instantiate() method; I've placed a print
 statement in the instantiate() method which fires at then end of the
 routine. That statement doesn't fire with the above code.

 The docs on magic methods are pretty slim, so I'm not sure what it is
 I'm missing. Can someone enlighten me?

 Paul


Paul,

I seem that you should missed the required underscore  _  
It should the __get() but not _get().
Shall this help ?

And here is a quick test !!

[ [ [
class test
{
public $varname = 1000;

public function __get($name)
{
return $this-init($name);
}

public function init($name)
{
return new test();
}
}

$t = new test();
$db = $t-database;
if (is_object($db))
{
echo $db-varname;
}

] ] ]


Regards,
Eric,


--
 Paul M. Foster

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




RE: [PHP] Magic Methods not working

2010-01-26 Thread Daevid Vincent
 -Original Message-
 From: Paul M Foster [mailto:pa...@quillandmouse.com] 
 Sent: Tuesday, January 26, 2010 7:05 PM
 To: php-general@lists.php.net
 Subject: [PHP] Magic Methods not working
 
 I have a class which instantiates other classes, and has a 
 magic method
 like this:
 
 function _get($classname)
 {
   return $this-instantiate($classname);
 }
 
 Obviously, the class also has an instantiate method which does what it
 says.
 
 Here's the problem: When I call the instantiate method, it works fine,
 like this:
 
 $db = $sc-instantiate('database');
 
 But when I do the following, it *doesn't* work:
 
 $db = $sc-database;
 
 In fact it does not call the instantiate() method; I've placed a print
 statement in the instantiate() method which fires at then end of the
 routine. That statement doesn't fire with the above code.
 
 The docs on magic methods are pretty slim, so I'm not sure what it is
 I'm missing. Can someone enlighten me?
 
 Paul

http://us2.php.net/manual/en/language.oop5.magic.php

There are TWO underscores needed, not one.

__get()

Also, just to save you some time/grief, you might consider using my awesome
routines:

Put these in your base.class.php and extend it for all other classes.
Magic.

/**
* Provides generic getters and setters
*
* @access   public
* @param   string $method The method name.
* @param   array $arguments The arguments passed to the method.
* @return   mixed
* @author   Daevid Vincent [dae...@daevid.com]
* @date 02/02/09
* @see  __get(), __set()
*/
public function __call( $method, $arguments )
{
$prefix = strtolower( substr( $method, 0, 3 ) );
$property = strtolower( substr( $method, 4 ) );

if ( empty($prefix) || empty($property) ) return;
//exit(__call($method) :: prefix='$prefix' and
property='$property');

if ( 'get' == $prefix )
{
if ( property_exists($this, $property) )
return $this-$property;
else
return $this-__get($property);
}
elseif ( 'set' == $prefix )
{
if ( property_exists($this, $property) )
return $this-$property = $arguments[0];
else
return $this-__set($property, $arguments[0]);
}

// Technically we should never get to this point as most calls are
get_() or set_()
echo pfont color='#ff'Attempted to
'.$prefix.-.$method.()' in class
'.$this-get_class_name().'./fontp\n;
backtrace();
}

/**
* magic function to handle any accessing of undefined variables.
* Since PHP is lax this will help prevent stupid mistakes.
*
* @access   public
* @return   void
* @parammixed $property name of the variable
* @author   Daevid Vincent [dae...@daevid.com]
* @date 05/14/09
* @see  __set(), __call()
*/
public function __get($property)
{
if ($_SESSION['DEVELOPMENT']  !$_SESSION['mobile'])
{
echo pfont color='#ff'Attempted to __get()
non-existant property/variable '.$property.' in class
'.$this-get_class_name().'./fontp\n;
$this-suggest_alternative($property);
backtrace();
exit;
}
else exit(__get($property) NO SUCH PROPERTY IN
.$this-get_class_name().' CLASS');

//Throw new BadProperty($this, 'get', $property);
}

/**
* magic function to handle any setting of undefined variables.
* Since PHP is lax this will help prevent stupid mistakes.
*
* @access   public
* @return   void
* @parammixed $property name of the variable
* @parammixed $val value of the variable
* @author   Daevid Vincent [dae...@daevid.com]
* @date 05/14/09
* @see  __get(), __call()
*/
public function __set($property, $val)
{
if ($_SESSION['DEVELOPMENT']  !$_SESSION['mobile'])
{
echo pfont color='#ff'Attempted to __set()
non-existant property/variable '.$property.' to '.$val.' in class
'.$this-get_class_name().'./fontp\n;
$this-suggest_alternative($property);
backtrace();
exit;
}
else exit(__set($property) NO SUCH PROPERTY IN
.$this-get_class_name().' CLASS');

//Throw new BadProperty($this, 'set', $property);
}

/**
 * Suggests alternative properties should a __get() or __set() fail
 *
 * @param   string $property
 * @return string
 * @author Daevid Vincent [dae...@daevid.com]
 * @date05/19/09
 * @see __get(), __set(), __call()
 */
public function suggest_alternative($property)
{
$parts = explode('_',$property);
foreach($parts as $i = $p) if ( in_array($p,
array('_','id','get','set')) ) unset($parts[$i]);

echo 'checking for b'.implode(' or ',$parts)./b and suggesting
the following:br/\n;

foreach($this as $key = $value)
foreach($parts as $p)

[PHP] Reliable way to identify Ogg types?

2010-01-26 Thread Michael A. Peters
When I use fileinfo on an uploaded Ogg file, the mime it returns is 
Application/Ogg which is almost useless.


Is there a reliable php way, preferably without needing to execute shell 
commands, to positively identify a file as Ogg Theora or Ogg Vorbis?


Thanks for suggestions.

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



Re: [PHP] Magic Methods not working

2010-01-26 Thread Paul M Foster
On Wed, Jan 27, 2010 at 11:19:34AM +0800, Eric Lee wrote:

 
 
 On Wed, Jan 27, 2010 at 11:04 AM, Paul M Foster pa...@quillandmouse.com
 wrote:
 
 I have a class which instantiates other classes, and has a magic method
 like this:
 
 function _get($classname)
 {
        return $this-instantiate($classname);
 }
 
 Obviously, the class also has an instantiate method which does what it
 says.
 
 Here's the problem: When I call the instantiate method, it works fine,
 like this:
 
 $db = $sc-instantiate('database');
 
 But when I do the following, it *doesn't* work:
 
 $db = $sc-database;
 
 In fact it does not call the instantiate() method; I've placed a print
 statement in the instantiate() method which fires at then end of the
 routine. That statement doesn't fire with the above code.
 
 The docs on magic methods are pretty slim, so I'm not sure what it is
 I'm missing. Can someone enlighten me?
 
 Paul
 
 
 
 Paul,
 
 I seem that you should missed the required underscore  _  
 It should the __get() but not _get().
 Shall this help ?

Great Caesar's Ghost! You're right! Thanks.

Paul

-- 
Paul M. Foster

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



[PHP] help with preg_replace pattern

2010-01-26 Thread Rob Gould
It appears that IE renders it's display: none in all caps while Firefox and 
other browsers pass it back in lowercase.  This throws off my php line of code 
the is supposed to nuke blank bullets from a string of text:
$bl = 
LI style=DISPLAY: none id=bullet_ug2_col5_8/LI 
LI style=DISPLAY: none id=bullet_ug2_col4_8/LI 
LI style=DISPLAY: none id=bullet_ug2_col3_8/LI 
LI style=DISPLAY: none id=bullet_ug2_col2_8/LI 
LI style=DISPLAY: none id=bullet_ug2_8/LI 
LI style=DISPLAY: none id=bullet_ug1_col4_8/LI 
LI style=DISPLAY: list-item id=bullet_ug1_col3_8Reserved Frontstretch Tower 
Ticket to the NextEra Energy Resources 250 on Friday Night /LI 
LI style=DISPLAY: list-item id=bullet_ug1_col2_8Reserved Frontstretch Tower 
Ticket to the Camping World 300 on Saturday /LI 
LI style=DISPLAY: list-item id=bullet_2_8Reserved Frontstretch Tower Ticket 
to the Daytona 500 on Sunday /LI 
LI style=DISPLAY: none id=bullet_addon_col2_8/LI 
LI style=DISPLAY: none id=bullet_addon3_8/LI 
LI style=DISPLAY: none id=bullet_option2_col4_8/LI 
LI style=DISPLAY: none id=bullet_option2_col3_8/LI 
LI style=DISPLAY: none id=bullet_option2_col2_8/LI 
LI style=DISPLAY: none id=bullet_option2_col1_8/LI 
LI style=DISPLAY: none id=bullet_option3_col4_8/LI 
LI style=DISPLAY: none id=bullet_option3_col3_8/LI 
LI style=DISPLAY: none id=bullet_option3_col2_8/LI 
LI style=DISPLAY: none id=bullet_option3_col1_8/LI 
LI style=DISPLAY: none id=bullet_option4_col4_8/LI 
LI style=DISPLAY: none id=bullet_option4_col3_8/LI

I want to keep the DISPLAY: list-item lines, and nuke all the others.
The below above are sent to PHP in a variable called $bl.  I then try to nuke 
the DISPLAY: none lines with something like:

$pattern = '/li[^]*style=display: none[^]*/';
$bl = preg_replace($pattern,'',$bl);

$pattern = '/li[^]*style=DISPLAY: none[^]*/';
$bl = preg_replace($pattern,'',$bl);

But it appears that the case-sensitivity fix is not just a matter of making the 
letter capitals.  I'm sure someone who knows more than I about preg_replace 
will see the 
immediate error of my ways.  Any advice is greatly appreciated.







Re: [PHP] Reliable way to identify Ogg types?

2010-01-26 Thread Paul M Foster
On Tue, Jan 26, 2010 at 07:23:24PM -0800, Michael A. Peters wrote:

 When I use fileinfo on an uploaded Ogg file, the mime it returns is
 Application/Ogg which is almost useless.

 Is there a reliable php way, preferably without needing to execute shell
 commands, to positively identify a file as Ogg Theora or Ogg Vorbis?

Judging by the return, the OS is looking at the mime.types file, which
(on my box at least) doesn't know anything more than this.

In order to get what you want, I'm afraid you might have to open the
file and examine its first few bytes using the data from
/usr/share/file/magic, which has a more thoroughgoing understanding of
ogg files. Unless someone's built a class which does this for you.

Paul

-- 
Paul M. Foster

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



Re: [PHP] Reliable way to identify Ogg types?

2010-01-26 Thread Eric Lee
Hi Micheal,

One of way for this should be by checking the header of the file with its
OggS magic number.
You may take a look at this page to see if it could help !

http://en.wikipedia.org/wiki/Ogg


But I'am confused that the mime type should be enough what type of data its
coming !
Are there are any more  things you need to concern ?


Thanks,


Regards,
Eric,


On Wed, Jan 27, 2010 at 11:23 AM, Michael A. Peters mpet...@mac.com wrote:

 When I use fileinfo on an uploaded Ogg file, the mime it returns is
 Application/Ogg which is almost useless.

 Is there a reliable php way, preferably without needing to execute shell
 commands, to positively identify a file as Ogg Theora or Ogg Vorbis?

 Thanks for suggestions.

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




Re: [PHP] Magic Methods not working

2010-01-26 Thread Paul M Foster
On Tue, Jan 26, 2010 at 07:21:34PM -0800, Daevid Vincent wrote:

  -Original Message-
  From: Paul M Foster [mailto:pa...@quillandmouse.com]
  Sent: Tuesday, January 26, 2010 7:05 PM
  To: php-general@lists.php.net
  Subject: [PHP] Magic Methods not working
 
  I have a class which instantiates other classes, and has a
  magic method
  like this:
 
  function _get($classname)
  {
  return $this-instantiate($classname);
  }
 
  Obviously, the class also has an instantiate method which does what it
  says.
 
  Here's the problem: When I call the instantiate method, it works fine,
  like this:
 
  $db = $sc-instantiate('database');
 
  But when I do the following, it *doesn't* work:
 
  $db = $sc-database;
 
  In fact it does not call the instantiate() method; I've placed a print
  statement in the instantiate() method which fires at then end of the
  routine. That statement doesn't fire with the above code.
 
  The docs on magic methods are pretty slim, so I'm not sure what it is
  I'm missing. Can someone enlighten me?
 
  Paul
 
 http://us2.php.net/manual/en/language.oop5.magic.php
 
 There are TWO underscores needed, not one.
 
 __get()
 
 Also, just to save you some time/grief, you might consider using my awesome
 routines:
 
 Put these in your base.class.php and extend it for all other classes.
 Magic.

Oh no. I can't use those. The braces are in all the wrong places! (All
praise be to KR...) ;-}

Paul

-- 
Paul M. Foster

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



Re: [PHP] help with preg_replace pattern

2010-01-26 Thread Adam Richardson
On Tue, Jan 26, 2010 at 10:37 PM, Rob Gould gould...@mac.com wrote:

 It appears that IE renders it's display: none in all caps while Firefox and
 other browsers pass it back in lowercase.  This throws off my php line of
 code the is supposed to nuke blank bullets from a string of text:
 $bl =
 LI style=DISPLAY: none id=bullet_ug2_col5_8/LI
 LI style=DISPLAY: none id=bullet_ug2_col4_8/LI
 LI style=DISPLAY: none id=bullet_ug2_col3_8/LI
 LI style=DISPLAY: none id=bullet_ug2_col2_8/LI
 LI style=DISPLAY: none id=bullet_ug2_8/LI
 LI style=DISPLAY: none id=bullet_ug1_col4_8/LI
 LI style=DISPLAY: list-item id=bullet_ug1_col3_8Reserved Frontstretch
 Tower Ticket to the NextEra Energy Resources 250 on Friday Night /LI
 LI style=DISPLAY: list-item id=bullet_ug1_col2_8Reserved Frontstretch
 Tower Ticket to the Camping World 300 on Saturday /LI
 LI style=DISPLAY: list-item id=bullet_2_8Reserved Frontstretch Tower
 Ticket to the Daytona 500 on Sunday /LI
 LI style=DISPLAY: none id=bullet_addon_col2_8/LI
 LI style=DISPLAY: none id=bullet_addon3_8/LI
 LI style=DISPLAY: none id=bullet_option2_col4_8/LI
 LI style=DISPLAY: none id=bullet_option2_col3_8/LI
 LI style=DISPLAY: none id=bullet_option2_col2_8/LI
 LI style=DISPLAY: none id=bullet_option2_col1_8/LI
 LI style=DISPLAY: none id=bullet_option3_col4_8/LI
 LI style=DISPLAY: none id=bullet_option3_col3_8/LI
 LI style=DISPLAY: none id=bullet_option3_col2_8/LI
 LI style=DISPLAY: none id=bullet_option3_col1_8/LI
 LI style=DISPLAY: none id=bullet_option4_col4_8/LI
 LI style=DISPLAY: none id=bullet_option4_col3_8/LI

 I want to keep the DISPLAY: list-item lines, and nuke all the others.
 The below above are sent to PHP in a variable called $bl.  I then try to
 nuke the DISPLAY: none lines with something like:

 $pattern = '/li[^]*style=display: none[^]*/';
 $bl = preg_replace($pattern,'',$bl);

 $pattern = '/li[^]*style=DISPLAY: none[^]*/';
 $bl = preg_replace($pattern,'',$bl);

 But it appears that the case-sensitivity fix is not just a matter of making
 the letter capitals.  I'm sure someone who knows more than I about
 preg_replace will see the
 immediate error of my ways.  Any advice is greatly appreciated.






Your regex is looking for case-sensitive matches, which given the example
below, would preclude all of your list items (they all start with LI, not
li.)

Try using a case insensitive regex (e.g., $bl = preg_replace($pattern
= /li[^]*style=DISPLAY: none[^]*/i','',$bl);

(Note the i after the search pattern above.)

Adam


-- 
Nephtali:  PHP web framework that functions beautifully
http://nephtaliproject.com


Re: [PHP] Creating an Entire .html page with PHP

2010-01-26 Thread clancy_1
On Tue, 26 Jan 2010 18:52:06 -0800, dae...@daevid.com (Daevid Vincent) wrote:



First of all writing pages in this old fashioned .cgi sort of way is so
1990's. Concatenating your whole page to a giant string is silly and
defeats the benefits (and purpose) of using PHP.
I'm actually in the process of porting a HUGE site from that style to a
more sane MVC and PHPish way right now. It makes me cringe every day I have
to look at 'old' code.

I suggest you read the question that started all this. 

I don't know why you should want to store a compiled page, but someone asked 
how they
could do it, and I have suggested one way.  PHP doesn't seem to have any 
problems with
long strings (file_put_contents  file_get_contents actually treat the contents 
as a
string, and they don't slow down till the length grows past ~100k), so if you 
did, this
would work as well as any other way.

And however you generate a web page, it is effectively sent to the browser as a 
string
(which can include linefeeds and all the rest) so this would work regardless of 
whatever
fancy tricks you used to generate it.

(And I don't open HTML e-mails if I can possibly avoid it.)

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



Re: [PHP] Reliable way to identify Ogg types?

2010-01-26 Thread Michael A. Peters

Eric Lee wrote:


Hi Micheal,

One of way for this should be by checking the header of the file with 
its OggS magic number.

You may take a look at this page to see if it could help !

http://en.wikipedia.org/wiki/Ogg


But I'am confused that the mime type should be enough what type of data 
its coming !

Are there are any more  things you need to concern ?


The problem is that fileinfo just reports application/ogg for both Ogg 
Vorbis and Ogg Theora files, and I never want to trust extension or user 
to properly identify file.


Maybe I need to update some library that fileinfo function is built 
against or uses.


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



Re: [PHP] Do you use a public framework or roll your own?

2010-01-26 Thread Michael Kubler
I read somewhere (can't find the link at the moment) that there's 
probably 2.5 frameworks per PHP developer.
I know that when I started I was writing my own bits and pieces of two 
frameworks. One was function based and the other was OO based.
I've since found the Yii http://www.yiiframework.com/ PHP framework 
and LOVE it. As someone that used to do assembly code programming on Pic 
microcontrollers with very little SQL background it was a bit of work to 
try and understand OO, MVC, ActiveRecord, etc.. But now that I have I'm 
much faster and more efficient. There's also the added bonus that being 
a Open Source project it is being worked on by lots of people and 
constantly getting better.


So I'd have to vote twice. I've used my own frameworks, but now using a 
proper one.


My 2c.
--
Michael Kubler
I believe in a better world. I support the Zeitgeist Movement 
http://www.zeitgeistsa.com.



James McLean wrote:

In hindsight, it's a little clunky now. But I was proud of it and I
still am to a point :) Personally I believe any PHP developer who
wants to be taken seriously should have written thier own framework :)
  


Re: [PHP] Do you use a public framework or roll your own?

2010-01-26 Thread James McLean
On Wed, Jan 27, 2010 at 4:50 PM, Michael Kubler mdk...@gmail.com wrote:
 I read somewhere (can't find the link at the moment) that there's probably
 2.5 frameworks per PHP developer.

There would be a lot of truth to that, I hacked up a smaller  simpler
PHP4-centric framework back in the days when it was supported
alongside PHP5 - but the webhost wouldn't move to PHP5. So i've
written at least 2 myself :) Weather they are any good is a totally
different matter of course :D

Cheers

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



Re: [PHP] Do you use a public framework or roll your own?

2010-01-26 Thread clancy_1
On Tue, 26 Jan 2010 21:57:05 -0500, pa...@quillandmouse.com (Paul M Foster) 
wrote:

On Tue, Jan 26, 2010 at 04:17:26PM -0800, Daevid Vincent wrote:

 
 I'm not looking to start a holy war here or re-hash the tired debate.
 I just want some hard cold numbers to look at.
 
 Do you use a public framework or roll your own?
 http://www.rapidpoll.net/8opnt1e

I voted, but like others, my framework is more a collection of home
grown tools which seem to have generic applicability.

Some of this may be because I worked for many years in construction. You
get used to certain tools and the way they operate, and you prefer them.
For example, I won't use screwdrivers whose handles aren't covered with
rubber over the plastic of the handles (Stanley and Klein brands).

What I like about programming is that you get to build your own tools,
just the way you like them. ;-}

I totally agree. I started programming in the 60s on the CDC 3200/3600 series, 
which had
an incredibly primitive version of Fortran. Then I started my own business and 
didn't
program again until the late 70s, when I purchased a North Star personal 
computer running
CPM under N*Dos.  I started writing programs in assembler for instruments using
microprocessors.  The first thing I did was to develop a library of useful 
functions to do
the sorts of things you need to do in an instrument.  I started with some early
microprocessor I never actually used, then progressed through RCA1802, 8080, 
6800, and
finally 80X86. 

Once I had got my library working, I found it relatively simple to update it 
from one
microprocessor to the next. In the early 1980s I got a job as a lecturer in
instrumentation and assembly language programming at a College of Advanced 
Education. I
used my library to show the students how to program simple instruments, and in 
the process
I learned a lot about how to design programs that students could use.

In 1989 the computer labs were invaded by an accidentally lethal virus, which 
rendered the
(non-standard) computers useless.  Because I understood assembler, I was able to
disassemble the boot sector, and work out how to remove the virus, and because 
I knew how
students thought I could write a program which they could use to disinfect 
their computers
at home. Because my library had nearly all the necessary functions I was able 
to write my
program (which removed that particular virus) in a couple of days. I gave it to 
the
students as shareware and at the end of the year I was able to resign.

Nine years later we sold the program to Computer Associates, and I retired.

I am back into programming because Microsoft (and many other software firms) 
insist on
writing programs which make you do what they think you ought to do, not what 
you want to
do. It used to be quite simple to use Mailmerge to manage a mailing list, but a 
couple of
updates of Windows ago it became virtually impossible.  I suspect that many of 
these
public frameworks will do the same.

And if you have written your own tools, you can easily change them if you don't 
like them.


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



Re: [PHP] Do you use a public framework or roll your own?

2010-01-26 Thread Lester Caine

Daevid Vincent wrote:
 
I'm not looking to start a holy war here or re-hash the tired debate. 
I just want some hard cold numbers to look at.


Do you use a public framework or roll your own?
http://www.rapidpoll.net/8opnt1e


I'm not sure quite what to answer here. I've been using bitweaver for some time 
now, but I'm not sure that I would classify it as a 'public framework' since I 
also roll my own packages to go with it. It think I need a 'Tailor your own from 
open source project' ?


--
Lester Caine - G8HFL
-
Contact - http://lsces.co.uk/wiki/?page=contact
L.S.Caine Electronic Services - http://lsces.co.uk
EnquirySolve - http://enquirysolve.com/
Model Engineers Digital Workshop - http://medw.co.uk//
Firebird - http://www.firebirdsql.org/index.php

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