php-general Digest 1 May 2009 00:51:44 -0000 Issue 6096

Topics (messages 292149 through 292167):

Re: Warning: Division by zero
        292149 by: kyle.smith
        292150 by: Christoph Boget
        292153 by: Gary
        292154 by: Christoph Boget

Re: Static and/or Dynamic site scraping using PHP
        292151 by: 9el
        292156 by: Shawn McKenzie

Re: Getting Sub Elements with XPath
        292152 by: Andrew Ballard

Re: utf-8 ?
        292155 by: Tom Worster
        292161 by: Reese
        292162 by: Andrew Hucks
        292164 by: Tom Worster
        292165 by: Chris

Re: Two very useful PHP functions
        292157 by: Daniel Brown

$this = new Class();
        292158 by: Olivier Lalonde

Re: php forms - select menu selected behavior
        292159 by: Ashley Sheridan

object literals
        292160 by: Tom Worster

Bhups on the go for a Charity Walk! - Any support appreciated.
        292163 by: memberservices.justgiving.com

Eclipse, PDT plugins for hosting, scaling and managing PHP apps.
        292166 by: Kevin Hakman

Re: DateInterval
        292167 by: MIke Alaimo

Administrivia:

To subscribe to the digest, e-mail:
        php-general-digest-subscr...@lists.php.net

To unsubscribe from the digest, e-mail:
        php-general-digest-unsubscr...@lists.php.net

To post to the list, e-mail:
        php-gene...@lists.php.net


----------------------------------------------------------------------
--- Begin Message ---
It's always better to validate your inputs in any was possible, this
helps prevent exploits. 

-----Original Message-----
From: Gary [mailto:gwp...@ptd.net] 
Sent: Thursday, April 30, 2009 8:51 AM
To: php-gene...@lists.php.net
Subject: [PHP] Warning: Division by zero

I have a script that is a result of data entered in a form

On the script (when I test without data entry), I am getting a warning
that
Warning: Division by zero in .inc.php on line 15.

The warning is correct, however the viewer cannot access the second
script without entering the data that would cancel the warning.

Is this something I should worry about? or would it be better to right
in an isset?

I'm sorry if this does not seem clear. 



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


--- End Message ---
--- Begin Message ---
> I have a script that is a result of data entered in a form
> On the script (when I test without data entry), I am getting a warning that
> Warning: Division by zero in .inc.php on line 15.
> The warning is correct, however the viewer cannot access the second script
> without entering the data that would cancel the warning.
> Is this something I should worry about? or would it be better to right in an
> isset?

Well, just as a general rule, you'll want to validate all possible
user input.  That includes checking whether or not particular input
has been defined, whether or not it is valid for it's intended use and
whether or not it's malicious.

Applying that guideline to your situation, I would check to see if:

* the input is set
* the input is numeric

If either or those are not true, I would default the value to 1 since
division is being used. e.g.,

$iVar = 1;
if(( isset( $_REQUEST['MY_NUMBER'] ) && ( is_numeric(
$_REQUEST["MY_NUMBER']))) {
  $iVar = $_REQUEST['MY_NUMBER'];
}

$iCalculatedValue = $x / $iVar;

thnx,
Christoph

--- End Message ---
--- Begin Message ---
Thanks for your response.

The error I am getting is when I am defining a variable.

(line 15) $percent_difference=($assess_difference)/($assess_value);

Does this make a difference?

Thanks again for all your help.

Gary


"Christoph Boget" <christoph.bo...@gmail.com> wrote in message 
news:540509760904300600i7af94667w6bad30ed068d1...@mail.gmail.com...
>> I have a script that is a result of data entered in a form
>> On the script (when I test without data entry), I am getting a warning 
>> that
>> Warning: Division by zero in .inc.php on line 15.
>> The warning is correct, however the viewer cannot access the second 
>> script
>> without entering the data that would cancel the warning.
>> Is this something I should worry about? or would it be better to right in 
>> an
>> isset?
>
> Well, just as a general rule, you'll want to validate all possible
> user input.  That includes checking whether or not particular input
> has been defined, whether or not it is valid for it's intended use and
> whether or not it's malicious.
>
> Applying that guideline to your situation, I would check to see if:
>
> * the input is set
> * the input is numeric
>
> If either or those are not true, I would default the value to 1 since
> division is being used. e.g.,
>
> $iVar = 1;
> if(( isset( $_REQUEST['MY_NUMBER'] ) && ( is_numeric(
> $_REQUEST["MY_NUMBER']))) {
>  $iVar = $_REQUEST['MY_NUMBER'];
> }
>
> $iCalculatedValue = $x / $iVar;
>
> thnx,
> Christoph 



--- End Message ---
--- Begin Message ---
> The error I am getting is when I am defining a variable.
> (line 15) $percent_difference=($assess_difference)/($assess_value);
> Does this make a difference?

No, it doesn't make a difference.  The simple fact is that
$assess_value is either undefined or has been set to 0 at some point.
For it's use in the above equation, neither case is valid.
Consequently, you really should be doing some validation at some point
prior to that line.

thnx,
Christoph

--- End Message ---
--- Begin Message ---
On Thu, Apr 30, 2009 at 3:33 AM, 9el <le...@phpxperts.net> wrote:
> I just got a project to do on PHP of scraping the body items from
> static sites or just html sites.
> Could you experts please suggest me some quick resources?
>
> I have to make an WP plugin with the data as well.

Any expert there yet? Was looking for urgent advices on accomplishing the task.

Thanks

Lenin

www.twitter.com/nine_L

--- End Message ---
--- Begin Message ---
9el wrote:
> On Thu, Apr 30, 2009 at 3:33 AM, 9el <le...@phpxperts.net> wrote:
>> I just got a project to do on PHP of scraping the body items from
>> static sites or just html sites.
>> Could you experts please suggest me some quick resources?
>>
>> I have to make an WP plugin with the data as well.
> 
> Any expert there yet? Was looking for urgent advices on accomplishing the 
> task.
> 
> Thanks
> 
> Lenin
> 
> www.twitter.com/nine_L

If you're just capturing and using the body, the load with
file_get_contents() and use preg_match() to select the body or
individual tags, etc...  For more control, maybe try this:

$doc = new DOMDocument();
$doc->loadHTMLFile('http://example.com/page.html');

Then use:  http://php.net/manual/book.dom.php

-- 
Thanks!
-Shawn
http://www.spidean.com

--- End Message ---
--- Begin Message ---
On Thu, Apr 30, 2009 at 5:02 AM, AngeloZanetti <angelo...@gmail.com> wrote:
>
> Hi all,
>
> I have the following XML returned to us.
>
> <Response ResponseReference="REF_657-17000-305754723972091">
>        <ResponseDetails Language="en">
>                <SearchChargeConditionsResponse>
>                        <ChargeConditions>
>                                <ChargeCondition Type="cancellation">
>                                        <Condition Charge="true" FromDay="0" 
> ToDay="0" Currency="ZAR"
> ChargeAmount="320.00"/>
>                                        <Condition Charge="false" FromDay="1"/>
>                                </ChargeCondition>
>                                <ChargeCondition Type="amendment" 
> MaximumPossibleChargesShown="true">
>                                        <Condition Charge="false" FromDay="0"/>
>                                </ChargeCondition>
>                                <PassengerNameChange Allowable="true"/>
>                        </ChargeConditions>
>                </SearchChargeConditionsResponse>
>        </ResponseDetails>
> </Response>
>
> We need to get the values of the FromDay, ToDay and ChargeAmount from the
> following sub elements:
>
> <Condition Charge="true" FromDay="0" ToDay="0" Currency="ZAR"
> ChargeAmount="320.00"/>
> <Condition Charge="false" FromDay="1"/>
>
> I hve the following code: But I am not able to get the second element's
> details: (Charge: false, FromDay: 1)
>
> $Elements = $xpath->query(
> 'ResponseDetails/SearchChargeConditionsResponse/ChargeConditions/ChargeCondition/',
> $responseElement );
>
>
>                                foreach( $Elements as $Element )
>                                {
>
>                                        $itemStatus = 
> $xpath->query('Condition/Charge' , $Element);
>                                        $FromDay2 = 
> $xpath->query('Condition/FromDay' , $Element);
>
>                                        $condition = 
> trim($itemStatus->item(0)->textContent);
>                                        echo "<br /><br />CONDITION: #" . 
> $condition."#";
>
>                                        $FromDay = 
> trim($FromDay2->item(0)->textContent);
>                                        echo " FromDay: " . $FromDay;
>
>                                        if ($condition =="true")
>                                        {
>                                                $ChargeAmount2 = 
> $xpath->query('Condition/@ChargeAmount' , $Element);
>                                                $ChargeAmount = 
> trim($ChargeAmount2->item(0)->textContent);
>                                                echo "  CHARGE AMT: " . 
> $ChargeAmount;
>
>                                                $ToDay = 
> $xpath->query('Condition/@ToDay' , $Element);
>                                                $ToDay = 
> trim($ToDay->item(0)->textContent);
>                                                echo " ToDay: " . $ToDay;
>
>                                        }
>                                        else if($condition =="false")
>                                        {
>                                                $FromDay2 = 
> $xpath->query('Condition/@FromDay' , $Element);
>                                                $FromDay = 
> trim($FromDay2->item(0)->textContent);
>                                                echo " FromDay: " . $FromDay;
>                                        }
>                                }
>
> It apprears that I need to add a further loop through the "ChargeCondition"
> elements, IE
>
> change
>
> $Elements = $xpath->query(
> 'ResponseDetails/SearchChargeConditionsResponse/ChargeConditions/ChargeCondition/',
> $responseElement );
>
>
> to
>
> $Elements = $xpath->query(
> 'ResponseDetails/SearchChargeConditionsResponse/ChargeConditions/',
> $responseElement );
>
> Then I can test the type if its "cancellation" and loop through the
> subelements (Condition)
>
> Would this appear to be correct?
>
> Anything else that would appear to be incorrect from the above code for the
> accompanying structure?
>
> thanks
> angelo
>

You might be able to cut down your code further with something like this:

<?php

$Elements = $xpath->query(
"ResponseDetails/SearchChargeConditionsResponse/ChargeConditions/chargeconditi...@type='cancellation']/Condition",
$responseElement );


foreach( $Elements as $Element )
{

    $condition = $Element->getAttribute('Charge');
    $FromDay = $Element->getAttribute('FromDay');

    echo "<br /><br />CONDITION: #" . $condition."#";

    echo " FromDay: " . $FromDay;

    if ($condition =="true")
    {
           $ChargeAmount = $Element->getAttribute('ChargeAmount');
           echo "  CHARGE AMT: " . $ChargeAmount;

           $ToDay = $Element->getAttribute('ToDay');
           echo " ToDay: " . $ToDay;

    }
    else if($condition =="false")
    {
           echo " FromDay: " . $FromDay;
    }
}

?>

I'm not sure if you really want it to print FromDay twice in the case
that Charge == 'false', but you should be able to sort that out.

Andrew

--- End Message ---
--- Begin Message ---
On 4/29/09 6:52 PM, "Reese" <howel...@inkworkswell.com> wrote:

> Tom Worster wrote:
>> On 4/28/09 4:05 PM, "Reese" <howel...@inkworkswell.com> wrote:
>> 
>>> Granted, this isn't a PHP question but I'm curious, how does UTF-8 solve
>>> this display issue?
>> 
>> if we're talking about web browsers, they are quite good at automatically
>> choosing fonts that can display the unicode characters it finds in a page.
> 
> Right, and I figured out the bit that was confusing me earlier: years
> ago, I read that some encodings such as &#0147; and &#0148; (curly
> quotes) should not be used, that &#8220; and &#8221; should be used
> instead. I misremembered that, when I looked at the utf-8 charset here:
> 
> http://www.columbia.edu/kermit/utf8-t1.html
> 
> I stand apprised and enlightened. I found the encodings for letters G
> with breve, S with cedilla, and lower case I w/out the dot, too.

why use SGML character entity references in a utf-8 file or stream? can't
you just put the character in the file?



--- End Message ---
--- Begin Message ---
Tom Worster wrote:

why use SGML character entity references in a utf-8 file or stream? can't
you just put the character in the file?

Because, I thought, HTML files were basically just text files with
different file extensions, and that those other characters would not
store or display properly if saved in .txt format. Was I mistaken?

http://www.cl.cam.ac.uk/~mgk25/ucs/examples/UTF-8-demo.txt

That is supposed to be a UTF-8 encoded text file, between 1/3 and 1/2
of the characters do not display correctly on my screen. Either way,
this next link suggests that Turkish characters with no equivalent in
the English language should be encoded for Web display:

http://webdesign.about.com/od/localization/l/blhtmlcodes-tr.htm

And because that is off-topic, I'll throw this in:

The consensus seems to be that the proposed "ifset()" and "ifempty()"
functions are more effort than they are worth. What I'd like to know
is, why "empty()" still exists when every time I turn around, the
mentors I turn to locally tell me not to use it, to use "isset()"
instead. Because empty() doesn't work with zero. Anyone care to take
a stab at that?

Reese


--- End Message ---
--- Begin Message ---
It'd be a hassle to just remove a function from a language, I suppose...

On Thu, Apr 30, 2009 at 6:15 PM, Reese <howel...@inkworkswell.com> wrote:
> Tom Worster wrote:
>
>> why use SGML character entity references in a utf-8 file or stream? can't
>> you just put the character in the file?
>
> Because, I thought, HTML files were basically just text files with
> different file extensions, and that those other characters would not
> store or display properly if saved in .txt format. Was I mistaken?
>
> http://www.cl.cam.ac.uk/~mgk25/ucs/examples/UTF-8-demo.txt
>
> That is supposed to be a UTF-8 encoded text file, between 1/3 and 1/2
> of the characters do not display correctly on my screen. Either way,
> this next link suggests that Turkish characters with no equivalent in
> the English language should be encoded for Web display:
>
> http://webdesign.about.com/od/localization/l/blhtmlcodes-tr.htm
>
> And because that is off-topic, I'll throw this in:
>
> The consensus seems to be that the proposed "ifset()" and "ifempty()"
> functions are more effort than they are worth. What I'd like to know
> is, why "empty()" still exists when every time I turn around, the
> mentors I turn to locally tell me not to use it, to use "isset()"
> instead. Because empty() doesn't work with zero. Anyone care to take
> a stab at that?
>
> Reese
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

--- End Message ---
--- Begin Message ---
On 4/30/09 6:15 PM, "Reese" <howel...@inkworkswell.com> wrote:

> Tom Worster wrote:
> 
>> why use SGML character entity references in a utf-8 file or stream? can't
>> you just put the character in the file?
> 
> Because, I thought, HTML files were basically just text files with
> different file extensions, and that those other characters would not
> store or display properly if saved in .txt format. Was I mistaken?

yes. see http://www.w3.org/TR/html401/charset.html

which says that html uses the UCS, a character-by-character equivalent to
the Unicode character set. so if you use a unicode character encoding (such
as utf-8) then you you have a direct encoding for every unicode character in
html.

so a utf-8 html file or stream should normally to have no entities other
than &lt;, &gt;, $amp; and perhaps &quot; as needed.

texts file may be utf-8 encoded too. xml, json and csv files are more
examples of text files that can be utf-8 encoded and use any unicode
character simply and directly. windows and os-x have used utf-8 as their
default text file encoding for many years now.


> http://www.cl.cam.ac.uk/~mgk25/ucs/examples/UTF-8-demo.txt
> 
> That is supposed to be a UTF-8 encoded text file, between 1/3 and 1/2
> of the characters do not display correctly on my screen.

this page looks great to me. i don't appear to have the runes or amharic
fonts on my computer so those aren't showing but everything else works.

why this doesn't work for you is not clear. it could be that your browser
has a preference configured to override the charset specified in the http
headers. or perhaps the browser does not observe the specified content type
for txt files.


> Either way,
> this next link suggests that Turkish characters with no equivalent in
> the English language should be encoded for Web display:
> 
> http://webdesign.about.com/od/localization/l/blhtmlcodes-tr.htm

don't believe everything you read on the web. while some browsers may
tolerate it, i don't think pages encoded according to those suggestions
would even be valid html.


> And because that is off-topic, I'll throw this in:
> 
> The consensus seems to be that the proposed "ifset()" and "ifempty()"
> functions are more effort than they are worth. What I'd like to know
> is, why "empty()" still exists when every time I turn around, the
> mentors I turn to locally tell me not to use it, to use "isset()"
> instead. Because empty() doesn't work with zero. Anyone care to take
> a stab at that?

perhaps because it's hard to get rid of language elements without breaking
existing code?



--- End Message ---
--- Begin Message ---

The consensus seems to be that the proposed "ifset()" and "ifempty()"
functions are more effort than they are worth. What I'd like to know
is, why "empty()" still exists when every time I turn around, the
mentors I turn to locally tell me not to use it, to use "isset()"
instead. Because empty() doesn't work with zero. Anyone care to take
a stab at that?

They serve different purposes and both work very well.

$form_errors = array();

// process form
foreach (array('name', 'email') as $field) {
  # Hey! someone hacked the form! This field is supposed to be there!
  if (!isset($_POST[$field])) {
    $form_errors[] = 'Field ' . $field . ' was missing';
    continue;
  }

  # The field is there but has no value.
  if (empty($_POST[$field])) {
    $form_errors[] = 'Field ' . $field . ' was empty';
  }
}

if (!empty($form_errors)) {
  echo 'there were errors in processing the form.<br/>';
  exit;
}

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


--- End Message ---
--- Begin Message ---
On Wed, Apr 29, 2009 at 22:32, Raymond Irving <xwis...@yahoo.com> wrote:
>
> What do you think? Can they make it into 5.3?

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

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

--- End Message ---
--- Begin Message ---
Hi all,

Since I can't do $this = new Class(); within my class (it gives an
error), I was looking for ways to get the same result by other means.

I am actually working on an ORM and trying to implement lazy loading.

$book = $orm->getBook('id'); // returns an Orm object
$book->load();

// $book should now be a Book instead instead of an Orm instance

Of course, I oversimplified the problem.  $book = $orm->getBook('id');
doesn't return a Book instance right ahead because it is a chained
method (i.e. $orm->getBook()->where(...)->prefetch(...)->etc....
Therefore, it _has_ to return an Orm instance.

Now, why not simply add ->load() at the end of the chain? Because it
adds an extra step for developers that doesn't bring meaningful
information. Instead of doing $book = $orm->getBook('id');, it would
mean having to do $book = $orm->getBook('id')->load(); (which is
longer to type :p). That's why I wanted to implement "lazy loading".

$book = $dorm->getBook('id');
echo $book->title; // title should be trapped by __set() and it should
dynamically replace $book by an actual Book instance

I tried doing the following, but PHP doesn't allow it:

class A {
  public function transform() {
    $this = new B();
  }
}

class B {}

$var = new A();
$var->transform();

This is not currently supported by PHP and I was wondering if there
was anyway of getting around the problem, that doesn't involve
1) passing $var to the A class i.e:$var->var = $var;
2) looping $GLOBALS[]
3) using __call,__get and __set to proxy everything to the actual Book object

PS1: don't lecture me about how I'm doing this all wrong. I've looked
at the problem from every possible angle and this is the only
solution.
PS2: Another alternative would be to subclass the Orm object with
Book, (class Orm extends Book {}), overload all properties/methods so
we can catch when to load the object... but that would be an extreme
pain in the ass.
PS3: Another alternative would be to have a parameter that
enables/disables chaining.
$dorm->getBook('id', true); // chain (you now have to add ->load() at
the end of the chain)
$dorm->getBook('id', false); // dont chain, this returns a Book instance

The point of all this is to keep the most friendly interface !

Cheers,
Olivier

--- End Message ---
--- Begin Message ---
On Thu, 2009-04-30 at 11:06 +0200, Marcus Gnaß wrote:
> Troy Oltmanns wrote:
> > I have the code below being used to rifle through a list of available
> > categories and create select options for them. The code is being used to
> > query the database and compare the product category to the current
> > iteration, if there's a match, then add selected code so the category is
> > prechosen. More code (not included) does the saving and all that, I've check
> > phpmyadmin. But when the page submits, the old category appears in the drop
> > down as selected. If I leave the page and come back it's fine, it's just
> > right after it is saved. The form script is being used on itself, in that
> > there is only one file for the form, the submission, etc. All of the other
> > input elements will load the data after being saved, is it something
> > specific to dropdowns, or it is the way the code is being instatiated?
> > 
> > All help is much appreciated. Please let me know if anymore info is needed.
> > 
> 
> //MAKE CATEGORIES DROPDOWN
> 
> $catlist1 = "";
> 
> // read product
> $catmatch = "SELECT prod_cat0 FROM product WHERE dbi='$dbi';";
> $catresult = mysql_query($catmatch);
> $catquery = mysql_fetch_array($catresult);
> 
> // read categories
> $sql = "SELECT category FROM categories ORDER BY category;";
> $result = mysql_query($sql);
> while ($col2 = mysql_fetch_array($result)) {
> 
>       $id = $col2["category"];
> 
>       if ($id == $catquery['prod_cat0']){
> 
>               $catlist1 .= "<option value=\"$id\" 
> selected=\"selected\">$id</option>";
> 
>       }       else {
> 
>               $catlist1 .= "<option value=\"$id\">$id</option>";
> 
>       }
> 
> }
> 
> > 
> > to instantiate <?=$catlist1?>
> > 
> 
> The only data you need from table product is the column prod_cat0, from
> table categories it's category, so you should read only the needed data
> instead of using * for better performance.
> 
> Take the SQL and verify if it returns what you want it to return then.
> 
I tend to do my loops like this:

while ($col2 = mysql_fetch_array($result))
{
    $id = $col2["category"];
    $selected =($id == $catquery['prod_cat0'])?'selected="selected"':'';

    $catlist1 .= "<option value=\"$id\" $selected>$id</option>";
}

Just looks a little neater. 'Course, you could remove the $id line and
chuck the value straight into the short if statement there.


Ash
www.ashleysheridan.co.uk


--- End Message ---
--- Begin Message ---
is there a neat literal syntax for creating objects on the fly without
defining a type?

whenever i need to do it i do something like

    $x = (object) array('a'=>1, 'b'=>3, ...);

which works but isn't very lovely. it's neater in, for example, javascript.



--- End Message ---
--- Begin Message ---
Hello!

I'm taking part in the ISSO Seva Charity Walk 2009 on 19/07/2009 to raise money 
for International Swaminarayan Satsang Organisation and I'd really appreciate 
your support.

It's easy to sponsor me online by credit or debit card - just go to my 
Justgiving page: 

http://www.justgiving.com/bhupspatel

Justgiving sends your donation straight to International Swaminarayan Satsang 
Organisation and automatically reclaims Gift Aid if you're a UK taxpayer, so 
your donation is worth even more. I hope you'll join me in supporting 
International Swaminarayan Satsang Organisation.

Thank you.

Bhupendra

P.S. I used Justgiving to send this email, so please don't reply to it. Replies 
will go to Justgiving, not to me!



--- End Message ---
--- Begin Message ---
re: Eclipse, PDT plugins for hosting, scaling and managing PHP apps.

Aptana has released a new suite of tools for PHP developers that extends the popular Eclipse PDT environment. The plugin for Eclipse, called Aptana Cloud Connect, lets you get all the benefits of scalable, on-demand PHP hosting in the Cloud with the ease of integration right into Eclipse and PDT (You can plug it into Zend Studio as well).

A few clicks is all that's needed to get a running PHP, MySQL, Apache environment running in about one minute. Then the plugin lets you instantly scale your web and database servers in the Cloud up or down anytime. There's a very useful set of visual database tools for working with your remote database. For file transfers, there's a "Smart Sync" utility that help you keep local projects coordinated with the remote sites.
You can do single file uploads/download and edits as well.

Try it out by adding Aptana Cloud Connect to your Eclipse 3.4 PDT installation.

Download and install instructions: http://update.aptana.com/install/cloudconnect/

More info at http://www.aptana.com/cloud
--- End Message ---
--- Begin Message ---
Ah.  This makes perfect sense.  Good idea.

Mike

Raymond Irving wrote:

--- On Wed, 4/29/09, MIke Alaimo <li...@reptiliannature.org> wrote:
Raymond, have you tried using DateTime::modify?  It
appears to work like strtotime.
also DateTime::format works like date.  At least as
far as I can tell.



From the little documentation that I've seen it appears that it's similar to 
strtotime and date but it would be very good if the PHP devs could make 
strtotime() and date() become wrappers for DateTime::modify and 
DateTime::format. This way we dont hae to modify our code when moving to a 
version of PHP that supports the new DateTime class.

__
Raymond Irving



--- End Message ---

Reply via email to