[PHP] difference PEAR PECL
Hi all, Wondering about the difference between PECL and PEAR, I found: http://board.phpbuilder.com/showthread.php?10339238-Pecl-vs-Pear Is it a suitable answer? If so, several Linux ditribution have: * php-pecl-xxx (PECL) * php-pear-vvv (PEAR) * php-yyy (???) packages (rpm and deb). What about the last kind? -- RMA. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] difference PEAR PECL
On Thu, Jul 19, 2012 at 12:18 PM, Mihamina Rakotomandimby miham...@rktmb.org wrote: Hi all, Wondering about the difference between PECL and PEAR, I found: http://board.phpbuilder.com/showthread.php?10339238-Pecl-vs-Pear Is it a suitable answer? It's close. PECL (sometimes pronounced pickle) stands for PHP Extension Community Library, which is - as the name suggests - a library of PHP extensions. Things like APC, memcache, amqp, and sqlite are examples of popular PECL extensions. PECL is a repository of compiled binaries. By contrast, PEAR - the PHP Extension and Application Repository - is actually not a library of extensions in the common definition, despite what the name suggests. Instead, it's a collection of unrelated reusable components, written in PHP, to be used for application development. PEAR is technically considered a framework, but is more commonly used as individual classes, as opposed to a full framework deployment in the traditional sense, such as Yii, Zend, CodeIgniter, 2x4, et al. Popular PEAR packages include Mail, PHP_Codesniffer, Date_Holidays, and various API service components such as those used with Amazon Web Services (AWS). PEAR components are supposed to follow the PEAR Coding Standard as well. If unsure which library to check for a given component, consider the following: PEAR components are always First_Letter_Capitalized, while PECL extensions are generally not. If so, several Linux ditribution have: * php-pecl-xxx (PECL) * php-pear-vvv (PEAR) * php-yyy (???) packages (rpm and deb). What about the last kind? php-pecl-xxx, php5-pecl, et cetera, are the PECL support libraries and may also refer to PECL extensions. php-pear-vvv, php5-pear, et cetera, are the PEAR support libraries and may also refer to PEAR components. php-yyy, php5-yyy, et cetera, are individual packages. For example, php_mysql or php5-cli. If possible, however, when installing PECL or PEAR packages, use the pecl or pear command line tool, respectively. For example: pecl install pdo_sqlite -- /Daniel P. Brown Network Infrastructure Manager http://www.php.net/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] difference PEAR PECL
On Thu, Jul 19, 2012 at 6:58 PM, Daniel Brown danbr...@php.net wrote: On Thu, Jul 19, 2012 at 12:18 PM, Mihamina Rakotomandimby miham...@rktmb.org wrote: Hi all, Wondering about the difference between PECL and PEAR, I found: http://board.phpbuilder.com/showthread.php?10339238-Pecl-vs-Pear Is it a suitable answer? It's close. PECL (sometimes pronounced pickle) stands for PHP Extension Community Library, which is - as the name suggests - a library of PHP extensions. Things like APC, memcache, amqp, and sqlite are examples of popular PECL extensions. PECL is a repository of compiled binaries. By contrast, PEAR - the PHP Extension and Application Repository - is actually not a library of extensions in the common definition, despite what the name suggests. Instead, it's a collection of unrelated reusable components, written in PHP, to be used for application development. PEAR is technically considered a framework, but is more commonly used as individual classes, as opposed to a full framework deployment in the traditional sense, such as Yii, Zend, CodeIgniter, 2x4, et al. Popular PEAR packages include Mail, PHP_Codesniffer, Date_Holidays, and various API service components such as those used with Amazon Web Services (AWS). PEAR components are supposed to follow the PEAR Coding Standard as well. If unsure which library to check for a given component, consider the following: PEAR components are always First_Letter_Capitalized, while PECL extensions are generally not. If so, several Linux ditribution have: * php-pecl-xxx (PECL) * php-pear-vvv (PEAR) * php-yyy (???) packages (rpm and deb). What about the last kind? php-pecl-xxx, php5-pecl, et cetera, are the PECL support libraries and may also refer to PECL extensions. php-pear-vvv, php5-pear, et cetera, are the PEAR support libraries and may also refer to PEAR components. php-yyy, php5-yyy, et cetera, are individual packages. For example, php_mysql or php5-cli. If possible, however, when installing PECL or PEAR packages, use the pecl or pear command line tool, respectively. For example: pecl install pdo_sqlite Is this really the recommended way on distros' which package the pecl packages? It seems to me it would be better to use the distros' version, so it has the required patches (if any) for them to work correctly on the distro, and they get upgraded automatically with the system updates. What is the advantage of using the pecl tool? - Matijn -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] difference PEAR PECL
On Thu, Jul 19, 2012 at 2:26 PM, Matijn Woudt tijn...@gmail.com wrote: Is this really the recommended way on distros' which package the pecl packages? It seems to me it would be better to use the distros' version, so it has the required patches (if any) for them to work correctly on the distro, and they get upgraded automatically with the system updates. What is the advantage of using the pecl tool? Using `pecl` will get you the most recently-published version. Using a distro's repo requires your distro's package management teams to actually be on top of things. And, in the sad majority of cases, it's simply not the way things are right now. Using `pecl` will build it from source using your installed API version and so forth. -- /Daniel P. Brown Network Infrastructure Manager http://www.php.net/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Difference between CURLOPT_URL and wget
Dear All, I am a beginner at PHP. I was studying the curl library and I came across CURLOPT_URL.I think this can be used similar to wget ? What would be the major differences in these 2 ? Thank you, Ashim
RE: [PHP] Difference between CURLOPT_URL and wget
-Original Message- From: Ashim Kapoor [mailto:ashimkap...@gmail.com] Sent: Saturday, January 22, 2011 5:09 AM To: php-general@lists.php.net Subject: [PHP] Difference between CURLOPT_URL and wget Dear All, I am a beginner at PHP. I was studying the curl library and I came across CURLOPT_URL.I think this can be used similar to wget ? What would be the major differences in these 2 ? Thank you, Ashim See the official info at #1 search result [1] from search [2]. Regards, Tommy [1] http://daniel.haxx.se/docs/curl-vs-wget.html [2] http://www.google.com/search?q=CURL_OPT+vs+wgetie=utf-8oe=utf-8aq=tclien t=firefox-arlz=1R1GGLL_en___US395 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] difference between two times? Date_diff and DateTime::diff
Hello, My journey of learning PHP is going well, so i've decided to make a small program which works out the difference between two times and records the data in a text file. I've searched the PHP manual for functions which can help me out, and I discovered the function Date_diff ( http://uk3.php.net/manual/en/function.date-diff.php )and the class DateTime::diff ( http://uk3.php.net/manual/en/datetime.diff.php ) My question is, how on earth do I use these functions ? I really don't understand the manual documentation. I've just moved onto the subject of classes and so I'm fairly new to the concept, although I am following it well. If someone could explain to me how to use ether of these ( Date_diff and DateTime::diff ) I would be VERY grateful. Thank you so much! Matt -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] difference between two times? Date_diff and DateTime::diff
Hi Tom, Thanks for the reply, I believe I have a fair understanding of functions, and I have followed the example on the PHP manual page ( http://uk3.php.net/manual/en/function.date-diff.php ), ideally I want to know how to use the class DateTime::diff, how can I use the DateTime::diff to get the difference between two times/ dates ? I suppose then I'm after the syntax would it be like this for example: $DIfferenceInTime = DateTime::diff(10:00,12:32); Thanks again for helping me out. On 16 Jun 2009, at 12:33, Tom Chubb wrote: Matt, Do you understand how to use functions? A function is defined like this: function () { //code goes here } You can pass arguments to be used in a function like this: function($arg1, $arg2) { //code goes here } In the first example on the following page: http://uk3.php.net/manual/en/function.date-diff.php To call the function you need to provide two arguments: $dtTime1 $dtTime2 To use in a script, you need to first define the function, as per the example: ?php function GetDeltaTime($dtTime1, $dtTime2) { $nUXDate1 = strtotime($dtTime1-format(Y-m-d H:i:s)); $nUXDate2 = strtotime($dtTime2-format(Y-m-d H:i:s)); $nUXDelta = $nUXDate1 - $nUXDate2; $strDeltaTime = . $nUXDelta/60/60; // sec - hour $nPos = strpos($strDeltaTime, .); if (nPos !== false) $strDeltaTime = substr($strDeltaTime, 0, $nPos + 3); return $strDeltaTime; } ? Then you need to call the function like this: ?php GetDeltaTime(time1-goes-here, time2-goes-here) ? And it should spit out the difference. Code is untested and if you didn't follow that I suggest you read up on functions: http://www.w3schools.com/php/php_functions.asp Hope this helps - I'm probably in a similar situation to you and have been dabbling with PHP for a few years just as a hobby but thought I'd try and help out. You'll learn a lot from reading this list as well. Cheers and good luck, Tom 2009/6/16 Matthew Croud m...@obviousdigital.com Hello, My journey of learning PHP is going well, so i've decided to make a small program which works out the difference between two times and records the data in a text file. I've searched the PHP manual for functions which can help me out, and I discovered the function Date_diff ( http://uk3.php.net/manual/en/function.date-diff.php )and the class DateTime::diff ( http://uk3.php.net/manual/en/datetime.diff.php ) My question is, how on earth do I use these functions ? I really don't understand the manual documentation. I've just moved onto the subject of classes and so I'm fairly new to the concept, although I am following it well. If someone could explain to me how to use ether of these ( Date_diff and DateTime::diff ) I would be VERY grateful. Thank you so much! Matt -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php Matthew Croud Studio Obvious Print Solutions Limited Unit 3 Abbeygate Court Stockett Lane Maidstone Kent ME15 0PP T | 0845 094 9704 F | 0845 094 9705 www.obviousprint.com
RE: [PHP] difference between two times? Date_diff and DateTime::diff
Hi Matthew, A quick note on the DateTime::diff() method - it's only available as from PHP 5.3, which is currently in release candidate stage, meaning unless you have your own server running PHP, it won't be available to use (hopefully - I would be sceptical of any webhost which rolls out RCs on production servers). If you need to know what version of PHP you're running, use: phpversion() or phpinfo() -Original Message- From: Matthew Croud [mailto:m...@obviousdigital.com] Sent: 16 June 2009 12:42 To: Tom Chubb Cc: PHP General list Subject: Re: [PHP] difference between two times? Date_diff and DateTime::diff Hi Tom, Thanks for the reply, I believe I have a fair understanding of functions, and I have followed the example on the PHP manual page ( http://uk3.php.net/manual/en/function.date-diff.php ), ideally I want to know how to use the class DateTime::diff, how can I use the DateTime::diff to get the difference between two times/ dates ? I suppose then I'm after the syntax would it be like this for example: $DIfferenceInTime = DateTime::diff(10:00,12:32); Thanks again for helping me out. On 16 Jun 2009, at 12:33, Tom Chubb wrote: Matt, Do you understand how to use functions? A function is defined like this: function () { //code goes here } You can pass arguments to be used in a function like this: function($arg1, $arg2) { //code goes here } In the first example on the following page: http://uk3.php.net/manual/en/function.date-diff.php To call the function you need to provide two arguments: $dtTime1 $dtTime2 To use in a script, you need to first define the function, as per the example: ?php function GetDeltaTime($dtTime1, $dtTime2) { $nUXDate1 = strtotime($dtTime1-format(Y-m-d H:i:s)); $nUXDate2 = strtotime($dtTime2-format(Y-m-d H:i:s)); $nUXDelta = $nUXDate1 - $nUXDate2; $strDeltaTime = . $nUXDelta/60/60; // sec - hour $nPos = strpos($strDeltaTime, .); if (nPos !== false) $strDeltaTime = substr($strDeltaTime, 0, $nPos + 3); return $strDeltaTime; } ? Then you need to call the function like this: ?php GetDeltaTime(time1-goes-here, time2-goes-here) ? And it should spit out the difference. Code is untested and if you didn't follow that I suggest you read up on functions: http://www.w3schools.com/php/php_functions.asp Hope this helps - I'm probably in a similar situation to you and have been dabbling with PHP for a few years just as a hobby but thought I'd try and help out. You'll learn a lot from reading this list as well. Cheers and good luck, Tom 2009/6/16 Matthew Croud m...@obviousdigital.com Hello, My journey of learning PHP is going well, so i've decided to make a small program which works out the difference between two times and records the data in a text file. I've searched the PHP manual for functions which can help me out, and I discovered the function Date_diff ( http://uk3.php.net/manual/en/function.date-diff.php )and the class DateTime::diff ( http://uk3.php.net/manual/en/datetime.diff.php ) My question is, how on earth do I use these functions ? I really don't understand the manual documentation. I've just moved onto the subject of classes and so I'm fairly new to the concept, although I am following it well. If someone could explain to me how to use ether of these ( Date_diff and DateTime::diff ) I would be VERY grateful. Thank you so much! Matt -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php Matthew Croud Studio Obvious Print Solutions Limited Unit 3 Abbeygate Court Stockett Lane Maidstone Kent ME15 0PP T | 0845 094 9704 F | 0845 094 9705 www.obviousprint.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] difference between two times? Date_diff and DateTime::diff
Hi Dajve and Tom, Thanks again, I totally didn't realise that this function is yet to be implemented in the mainstream PHP, So is there no function that exists in vanilla PHP that can take two dates/times and supply the difference ? If there isn't I do apologise, i've been talking to my friend who does ASP.net and he said he was sure there is for PHP. On 16 Jun 2009, at 13:11, Dajve Green wrote: Hi Matthew, A quick note on the DateTime::diff() method - it's only available as from PHP 5.3, which is currently in release candidate stage, meaning unless you have your own server running PHP, it won't be available to use (hopefully - I would be sceptical of any webhost which rolls out RCs on production servers). If you need to know what version of PHP you're running, use: phpversion() or phpinfo() -Original Message- From: Matthew Croud [mailto:m...@obviousdigital.com] Sent: 16 June 2009 12:42 To: Tom Chubb Cc: PHP General list Subject: Re: [PHP] difference between two times? Date_diff and DateTime::diff Hi Tom, Thanks for the reply, I believe I have a fair understanding of functions, and I have followed the example on the PHP manual page ( http://uk3.php.net/manual/en/function.date-diff.php ), ideally I want to know how to use the class DateTime::diff, how can I use the DateTime::diff to get the difference between two times/ dates ? I suppose then I'm after the syntax would it be like this for example: $DIfferenceInTime = DateTime::diff(10:00,12:32); Thanks again for helping me out. On 16 Jun 2009, at 12:33, Tom Chubb wrote: Matt, Do you understand how to use functions? A function is defined like this: function () { //code goes here } You can pass arguments to be used in a function like this: function($arg1, $arg2) { //code goes here } In the first example on the following page: http://uk3.php.net/manual/en/function.date-diff.php To call the function you need to provide two arguments: $dtTime1 $dtTime2 To use in a script, you need to first define the function, as per the example: ?php function GetDeltaTime($dtTime1, $dtTime2) { $nUXDate1 = strtotime($dtTime1-format(Y-m-d H:i:s)); $nUXDate2 = strtotime($dtTime2-format(Y-m-d H:i:s)); $nUXDelta = $nUXDate1 - $nUXDate2; $strDeltaTime = . $nUXDelta/60/60; // sec - hour $nPos = strpos($strDeltaTime, .); if (nPos !== false) $strDeltaTime = substr($strDeltaTime, 0, $nPos + 3); return $strDeltaTime; } ? Then you need to call the function like this: ?php GetDeltaTime(time1-goes-here, time2-goes-here) ? And it should spit out the difference. Code is untested and if you didn't follow that I suggest you read up on functions: http://www.w3schools.com/php/php_functions.asp Hope this helps - I'm probably in a similar situation to you and have been dabbling with PHP for a few years just as a hobby but thought I'd try and help out. You'll learn a lot from reading this list as well. Cheers and good luck, Tom 2009/6/16 Matthew Croud m...@obviousdigital.com Hello, My journey of learning PHP is going well, so i've decided to make a small program which works out the difference between two times and records the data in a text file. I've searched the PHP manual for functions which can help me out, and I discovered the function Date_diff ( http://uk3.php.net/manual/en/function.date-diff.php )and the class DateTime::diff ( http://uk3.php.net/manual/en/datetime.diff.php ) My question is, how on earth do I use these functions ? I really don't understand the manual documentation. I've just moved onto the subject of classes and so I'm fairly new to the concept, although I am following it well. If someone could explain to me how to use ether of these ( Date_diff and DateTime::diff ) I would be VERY grateful. Thank you so much! Matt -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php Matthew Croud Studio Obvious Print Solutions Limited Unit 3 Abbeygate Court Stockett Lane Maidstone Kent ME15 0PP T | 0845 094 9704 F | 0845 094 9705 www.obviousprint.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php Matthew Croud Studio Obvious Print Solutions Limited Unit 3 Abbeygate Court Stockett Lane Maidstone Kent ME15 0PP T | 0845 094 9704 F | 0845 094 9705 www.obviousprint.com
Re: [PHP] difference between two times? Date_diff and DateTime::diff
The first example here may help: http://us3.php.net/manual/en/function.time.php 2009/6/16 Matthew Croud m...@obviousdigital.com Hi Dajve and Tom, Thanks again, I totally didn't realise that this function is yet to be implemented in the mainstream PHP, So is there no function that exists in vanilla PHP that can take two dates/times and supply the difference ? If there isn't I do apologise, i've been talking to my friend who does ASP.net and he said he was sure there is for PHP. On 16 Jun 2009, at 13:11, Dajve Green wrote: Hi Matthew, A quick note on the DateTime::diff() method - it's only available as from PHP 5.3, which is currently in release candidate stage, meaning unless you have your own server running PHP, it won't be available to use (hopefully - I would be sceptical of any webhost which rolls out RCs on production servers). If you need to know what version of PHP you're running, use: phpversion() or phpinfo() -Original Message- From: Matthew Croud [mailto:m...@obviousdigital.com] Sent: 16 June 2009 12:42 To: Tom Chubb Cc: PHP General list Subject: Re: [PHP] difference between two times? Date_diff and DateTime::diff Hi Tom, Thanks for the reply, I believe I have a fair understanding of functions, and I have followed the example on the PHP manual page ( http://uk3.php.net/manual/en/function.date-diff.php ), ideally I want to know how to use the class DateTime::diff, how can I use the DateTime::diff to get the difference between two times/ dates ? I suppose then I'm after the syntax would it be like this for example: $DIfferenceInTime = DateTime::diff(10:00,12:32); Thanks again for helping me out. On 16 Jun 2009, at 12:33, Tom Chubb wrote: Matt, Do you understand how to use functions? A function is defined like this: function () { //code goes here } You can pass arguments to be used in a function like this: function($arg1, $arg2) { //code goes here } In the first example on the following page: http://uk3.php.net/manual/en/function.date-diff.php To call the function you need to provide two arguments: $dtTime1 $dtTime2 To use in a script, you need to first define the function, as per the example: ?php function GetDeltaTime($dtTime1, $dtTime2) { $nUXDate1 = strtotime($dtTime1-format(Y-m-d H:i:s)); $nUXDate2 = strtotime($dtTime2-format(Y-m-d H:i:s)); $nUXDelta = $nUXDate1 - $nUXDate2; $strDeltaTime = . $nUXDelta/60/60; // sec - hour $nPos = strpos($strDeltaTime, .); if (nPos !== false) $strDeltaTime = substr($strDeltaTime, 0, $nPos + 3); return $strDeltaTime; } ? Then you need to call the function like this: ?php GetDeltaTime(time1-goes-here, time2-goes-here) ? And it should spit out the difference. Code is untested and if you didn't follow that I suggest you read up on functions: http://www.w3schools.com/php/php_functions.asp Hope this helps - I'm probably in a similar situation to you and have been dabbling with PHP for a few years just as a hobby but thought I'd try and help out. You'll learn a lot from reading this list as well. Cheers and good luck, Tom 2009/6/16 Matthew Croud m...@obviousdigital.com Hello, My journey of learning PHP is going well, so i've decided to make a small program which works out the difference between two times and records the data in a text file. I've searched the PHP manual for functions which can help me out, and I discovered the function Date_diff ( http://uk3.php.net/manual/en/function.date-diff.php )and the class DateTime::diff ( http://uk3.php.net/manual/en/datetime.diff.php ) My question is, how on earth do I use these functions ? I really don't understand the manual documentation. I've just moved onto the subject of classes and so I'm fairly new to the concept, although I am following it well. If someone could explain to me how to use ether of these ( Date_diff and DateTime::diff ) I would be VERY grateful. Thank you so much! Matt -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php Matthew Croud Studio Obvious Print Solutions Limited Unit 3 Abbeygate Court Stockett Lane Maidstone Kent ME15 0PP T | 0845 094 9704 F | 0845 094 9705 www.obviousprint.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php Matthew Croud Studio Obvious Print Solutions Limited Unit 3 Abbeygate Court Stockett Lane Maidstone Kent ME15 0PP T | 0845 094 9704 F | 0845 094 9705 www.obviousprint.com -- Tom Chubb t...@tomchubb.com | tomch...@gmail.com 07912 202846
Re: [PHP] difference between two times? Date_diff and DateTime::diff
On 16 Jun 2009 at 14:05, Matthew Croud wrote: Hi Dajve and Tom, Thanks again, I totally didn't realise that this function is yet to be implemented in the mainstream PHP, So is there no function that exists in vanilla PHP that can take two dates/times and supply the difference ? If there isn't I do apologise, i've been talking to my friend who does ASP.net and he said he was sure there is for PHP. Hi, This is a quick function that works using unix time stamps. Its a bit quick and messy but works ok. Take a look at the manual page for the strtotime() function to get a better idea of what it can handle. ? $Date1_UnixTimeStamp=strtotime(10:10:45); $Date2_UnixTimeStamp=strtotime(12:45:03); print_r(DateDiff( $Date1_UnixTimeStamp, $Date2_UnixTimeStamp)); function DateDiff( $Date1_UnixTimeStamp, $Date2_UnixTimeStamp){ $return_difference = Array( Days = 0, Hours = 0, Minutes = 0, Seconds = 0 ); $amounts= Array( Days = 60*60*24, Hours = 60*60, Minutes = 60 ); $difference = $Date2_UnixTimeStamp - $Date1_UnixTimeStamp; if($difference = $amounts[Days]){ $return_difference[Days] = floor($difference / $amounts[Days]); $difference -= $return_difference[Days] * $amounts[Days]; } if($difference = $amounts[Hours]){ $return_difference[Hours] = floor($difference / $amounts[Hours]); $difference -= $return_difference[Hours] * $amounts[Hours]; } if($difference = $amounts[Minutes]){ $return_difference[Minutes] = floor($difference / $amounts[Minutes]); $difference -= $return_difference[Minutes] * $amounts[Minutes]; } $return_difference[Seconds] = $difference; return $return_difference; } ? Regards Ian -- On 16 Jun 2009, at 13:11, Dajve Green wrote: Hi Matthew, A quick note on the DateTime::diff() method - it's only available as from PHP 5.3, which is currently in release candidate stage, meaning unless you have your own server running PHP, it won't be available to use (hopefully - I would be sceptical of any webhost which rolls out RCs on production servers). If you need to know what version of PHP you're running, use: phpversion() or phpinfo() -Original Message- From: Matthew Croud [mailto:m...@obviousdigital.com] Sent: 16 June 2009 12:42 To: Tom Chubb Cc: PHP General list Subject: Re: [PHP] difference between two times? Date_diff and DateTime::diff Hi Tom, Thanks for the reply, I believe I have a fair understanding of functions, and I have followed the example on the PHP manual page ( http://uk3.php.net/manual/en/function.date-diff.php ), ideally I want to know how to use the class DateTime::diff, how can I use the DateTime::diff to get the difference between two times/ dates ? I suppose then I'm after the syntax would it be like this for example: $DIfferenceInTime = DateTime::diff(10:00,12:32); Thanks again for helping me out. On 16 Jun 2009, at 12:33, Tom Chubb wrote: Matt, Do you understand how to use functions? A function is defined like this: function () { //code goes here } You can pass arguments to be used in a function like this: function($arg1, $arg2) { //code goes here } In the first example on the following page: http://uk3.php.net/manual/en/function.date-diff.php To call the function you need to provide two arguments: $dtTime1 $dtTime2 To use in a script, you need to first define the function, as per the example: ?php function GetDeltaTime($dtTime1, $dtTime2) { $nUXDate1 = strtotime($dtTime1-format(Y-m-d H:i:s)); $nUXDate2 = strtotime($dtTime2-format(Y-m-d H:i:s)); $nUXDelta = $nUXDate1 - $nUXDate2; $strDeltaTime = . $nUXDelta/60/60; // sec - hour $nPos = strpos($strDeltaTime, .); if (nPos !== false) $strDeltaTime = substr($strDeltaTime, 0, $nPos + 3); return $strDeltaTime; } ? Then you need to call the function like this: ?php GetDeltaTime(time1-goes-here, time2-goes-here) ? And it should spit out the difference. Code is untested and if you didn't follow that I suggest you read up on functions: http://www.w3schools.com/php/php_functions.asp Hope this helps - I'm probably in a similar situation to you and have been dabbling with PHP for a few years just as a hobby but thought I'd try and help out. You'll learn a lot from reading this list as well. Cheers and good luck, Tom 2009/6/16 Matthew Croud m...@obviousdigital.com Hello, My journey of learning PHP is going
Re: [PHP] difference between two times? Date_diff and DateTime::diff
Wonderful, thanks Ian for your function, and also thank you Tom for having a head scratch on my behalf ;) On 16 Jun 2009, at 16:20, Ian wrote: On 16 Jun 2009 at 14:05, Matthew Croud wrote: Hi Dajve and Tom, Thanks again, I totally didn't realise that this function is yet to be implemented in the mainstream PHP, So is there no function that exists in vanilla PHP that can take two dates/times and supply the difference ? If there isn't I do apologise, i've been talking to my friend who does ASP.net and he said he was sure there is for PHP. Hi, This is a quick function that works using unix time stamps. Its a bit quick and messy but works ok. Take a look at the manual page for the strtotime() function to get a better idea of what it can handle. ? $Date1_UnixTimeStamp=strtotime(10:10:45); $Date2_UnixTimeStamp=strtotime(12:45:03); print_r(DateDiff( $Date1_UnixTimeStamp, $Date2_UnixTimeStamp)); function DateDiff( $Date1_UnixTimeStamp, $Date2_UnixTimeStamp){ $return_difference = Array( Days= 0, Hours = 0, Minutes = 0, Seconds = 0 ); $amounts= Array( Days= 60*60*24, Hours = 60*60, Minutes = 60 ); $difference = $Date2_UnixTimeStamp - $Date1_UnixTimeStamp; if($difference = $amounts[Days]){ $return_difference[Days] = floor($difference / $amounts[Days]); $difference -= $return_difference[Days] * $amounts[Days]; } if($difference = $amounts[Hours]){ $return_difference[Hours] = floor($difference / $amounts[Hours]); $difference -= $return_difference[Hours] * $amounts[Hours]; } if($difference = $amounts[Minutes]){ $return_difference[Minutes] = floor($difference / $amounts[Minutes]); $difference -= $return_difference[Minutes] * $amounts[Minutes]; } $return_difference[Seconds] = $difference; return $return_difference; } ? Regards Ian -- On 16 Jun 2009, at 13:11, Dajve Green wrote: Hi Matthew, A quick note on the DateTime::diff() method - it's only available as from PHP 5.3, which is currently in release candidate stage, meaning unless you have your own server running PHP, it won't be available to use (hopefully - I would be sceptical of any webhost which rolls out RCs on production servers). If you need to know what version of PHP you're running, use: phpversion() or phpinfo() -Original Message- From: Matthew Croud [mailto:m...@obviousdigital.com] Sent: 16 June 2009 12:42 To: Tom Chubb Cc: PHP General list Subject: Re: [PHP] difference between two times? Date_diff and DateTime::diff Hi Tom, Thanks for the reply, I believe I have a fair understanding of functions, and I have followed the example on the PHP manual page ( http://uk3.php.net/manual/en/function.date-diff.php ), ideally I want to know how to use the class DateTime::diff, how can I use the DateTime::diff to get the difference between two times/ dates ? I suppose then I'm after the syntax would it be like this for example: $DIfferenceInTime = DateTime::diff(10:00,12:32); Thanks again for helping me out. On 16 Jun 2009, at 12:33, Tom Chubb wrote: Matt, Do you understand how to use functions? A function is defined like this: function () { //code goes here } You can pass arguments to be used in a function like this: function($arg1, $arg2) { //code goes here } In the first example on the following page: http://uk3.php.net/manual/en/function.date-diff.php To call the function you need to provide two arguments: $dtTime1 $dtTime2 To use in a script, you need to first define the function, as per the example: ?php function GetDeltaTime($dtTime1, $dtTime2) { $nUXDate1 = strtotime($dtTime1-format(Y-m-d H:i:s)); $nUXDate2 = strtotime($dtTime2-format(Y-m-d H:i:s)); $nUXDelta = $nUXDate1 - $nUXDate2; $strDeltaTime = . $nUXDelta/60/60; // sec - hour $nPos = strpos($strDeltaTime, .); if (nPos !== false) $strDeltaTime = substr($strDeltaTime, 0, $nPos + 3); return $strDeltaTime; } ? Then you need to call the function like this: ?php GetDeltaTime(time1-goes-here, time2-goes-here) ? And it should spit out the difference. Code is untested and if you didn't follow that I suggest you read up on functions: http://www.w3schools.com/php/php_functions.asp Hope this helps - I'm probably in a similar situation to you and have been dabbling with PHP for a few years just as a hobby but thought I'd try and help out. You'll learn a lot from reading this list as well. Cheers and good luck, Tom 2009/6/16 Matthew Croud m...@obviousdigital.com Hello, My journey of learning PHP is going well, so i've decided to make a small program which works out
RE: [PHP] difference between two times? Date_diff and DateTime::diff
Also, if you're returning data from MySQL, there are a number of operations you can perform before it reaches your script: http://dev.mysql.com/doc/refman/5.1/en/date-and-time-functions.html From: Tom Chubb [mailto:tomch...@gmail.com] Sent: 16 June 2009 15:55 To: Matthew Croud Cc: Dajve Green; PHP General list Subject: Re: [PHP] difference between two times? Date_diff and DateTime::diff The first example here may help: http://us3.php.net/manual/en/function.time.php 2009/6/16 Matthew Croud m...@obviousdigital.com Hi Dajve and Tom, Thanks again, I totally didn't realise that this function is yet to be implemented in the mainstream PHP, So is there no function that exists in vanilla PHP that can take two dates/times and supply the difference ? If there isn't I do apologise, i've been talking to my friend who does ASP.net and he said he was sure there is for PHP. On 16 Jun 2009, at 13:11, Dajve Green wrote: Hi Matthew, A quick note on the DateTime::diff() method - it's only available as from PHP 5.3, which is currently in release candidate stage, meaning unless you have your own server running PHP, it won't be available to use (hopefully - I would be sceptical of any webhost which rolls out RCs on production servers). If you need to know what version of PHP you're running, use: phpversion() or phpinfo() -Original Message- From: Matthew Croud [mailto:m...@obviousdigital.com] Sent: 16 June 2009 12:42 To: Tom Chubb Cc: PHP General list Subject: Re: [PHP] difference between two times? Date_diff and DateTime::diff Hi Tom, Thanks for the reply, I believe I have a fair understanding of functions, and I have followed the example on the PHP manual page ( http://uk3.php.net/manual/en/function.date-diff.php ), ideally I want to know how to use the class DateTime::diff, how can I use the DateTime::diff to get the difference between two times/ dates ? I suppose then I'm after the syntax would it be like this for example: $DIfferenceInTime = DateTime::diff(10:00,12:32); Thanks again for helping me out. On 16 Jun 2009, at 12:33, Tom Chubb wrote: Matt, Do you understand how to use functions? A function is defined like this: function () { //code goes here } You can pass arguments to be used in a function like this: function($arg1, $arg2) { //code goes here } In the first example on the following page: http://uk3.php.net/manual/en/function.date-diff.php To call the function you need to provide two arguments: $dtTime1 $dtTime2 To use in a script, you need to first define the function, as per the example: ?php function GetDeltaTime($dtTime1, $dtTime2) { $nUXDate1 = strtotime($dtTime1-format(Y-m-d H:i:s)); $nUXDate2 = strtotime($dtTime2-format(Y-m-d H:i:s)); $nUXDelta = $nUXDate1 - $nUXDate2; $strDeltaTime = . $nUXDelta/60/60; // sec - hour $nPos = strpos($strDeltaTime, .); if (nPos !== false) $strDeltaTime = substr($strDeltaTime, 0, $nPos + 3); return $strDeltaTime; } ? Then you need to call the function like this: ?php GetDeltaTime(time1-goes-here, time2-goes-here) ? And it should spit out the difference. Code is untested and if you didn't follow that I suggest you read up on functions: http://www.w3schools.com/php/php_functions.asp Hope this helps - I'm probably in a similar situation to you and have been dabbling with PHP for a few years just as a hobby but thought I'd try and help out. You'll learn a lot from reading this list as well. Cheers and good luck, Tom 2009/6/16 Matthew Croud m...@obviousdigital.com Hello, My journey of learning PHP is going well, so i've decided to make a small program which works out the difference between two times and records the data in a text file. I've searched the PHP manual for functions which can help me out, and I discovered the function Date_diff ( http://uk3.php.net/manual/en/function.date-diff.php )and the class DateTime::diff ( http://uk3.php.net/manual/en/datetime.diff.php ) My question is, how on earth do I use these functions ? I really don't understand the manual documentation. I've just moved onto the subject of classes and so I'm fairly new to the concept, although I am following it well. If someone could explain to me how to use ether of these ( Date_diff and DateTime::diff ) I would be VERY grateful. Thank you so much! Matt -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php Matthew Croud Studio Obvious Print Solutions Limited Unit 3 Abbeygate Court Stockett Lane Maidstone Kent ME15 0PP T | 0845 094 9704 F | 0845 094 9705 www.obviousprint.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php Matthew Croud Studio Obvious Print Solutions Limited Unit 3 Abbeygate Court Stockett Lane Maidstone Kent ME15 0PP T | 0845 094 9704 F | 0845 094 9705 www.obviousprint.com -- Tom Chubb t...@tomchubb.com | tomch
Re: [PHP] Difference between imagegif/imagejpeg sending to browser - saving to file?
Lo again, found my mistake.. in fact, it was the hex-to-rgb conversion not working properly in some cases. [SUBJECT CLOSED] zyro wrote: Hello together, I stumbled onto a curious problem: i am generating a jpeg/gif with the imagejpeg/imagegif functions (type does not alter the result). Example color #ff: The hexToRGB coversion etc is all working fine. The image (if its send directly to the browser via header and imagegif/imagejpeg) is displayed 100% correctly. But if i save it to a file on the servers file system, the red above gets lime green. And not only those two colors are bugged: It looks like the whole palette gets scrambled up ??? So my question: Is there a-n-y difference between sending and saving the image? Or do I have to do some additional work before an image can be saved correctly? php func reference says something about using imagecolortransparent() on the image first to achieve the 89a format (in case of gif) but again: This does not alter the result either. Also, transparency is not needed at this point but used in images that are merged (gifs) to achieve the final result. Another interesting point: - generated image sent to browser, properties: ~3kb - generated image, saved in filesys, properties: ~15kb What explains that diff in filesize? Thanks for your help, greets, zyro -- View this message in context: http://www.nabble.com/Difference-between-imagegif-imagejpeg-sending-to-browser-%3C-%3E-saving-to-file--tp17078670p17123492.html Sent from the PHP - General mailing list archive at Nabble.com. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Difference between imagegif/imagejpeg sending to browser - saving to file?
Hello together, I stumbled onto a curious problem: i am generating a jpeg/gif with the imagejpeg/imagegif functions (type does not alter the result). Example color #ff: The hexToRGB coversion etc is all working fine. The image (if its send directly to the browser via header and imagegif/imagejpeg) is displayed 100% correctly. But if i save it to a file on the servers file system, the red above gets lime green. And not only those two colors are bugged: It looks like the whole palette gets scrambled up ??? So my question: Is there a-n-y difference between sending and saving the image? Or do I have to do some additional work before an image can be saved correctly? php func reference says something about using imagecolortransparent() on the image first to achieve the 89a format (in case of gif) but again: This does not alter the result either. Also, transparency is not needed at this point but used in images that are merged (gifs) to achieve the final result. Another interesting point: - generated image sent to browser, properties: ~3kb - generated image, saved in filesys, properties: ~15kb What explains that diff in filesize? Thanks for your help, greets, zyro -- View this message in context: http://www.nabble.com/Difference-between-imagegif-imagejpeg-sending-to-browser-%3C-%3E-saving-to-file--tp17078670p17078670.html Sent from the PHP - General mailing list archive at Nabble.com. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] difference in time
Lamp Lists wrote: hi to all! on one eZine site, I have to show when the article is posted but as difference from NOW. like posted 32 minutes ago, or posted 5 days ago. is there already sucha php/mysql function? thanks. Hi, I don't know about existing functions but you can use this: function time_to_units($time) { $years = floor($time / 60 / 60 / 24/ 365); $time -= $years * 60 * 60 * 24 * 365; $months = floor($time / 60 / 60 / 24 / 30); $time -= $months * 60 * 60 * 24 * 30; $weeks = floor($time / 60 / 60 / 24 / 7); $time -= $weeks * 60 * 60 * 24 * 7; $days = floor($time / 60 / 60 / 24); $time -= $days * 60 * 60 * 24; $hours = floor($time / 60 / 60); $time -= $hours * 60 * 60; $minutes = floor($time / 60); $time -= $minutes * 60; $seconds = $time; $amount = 0; $unit = ''; if ($years 0) { $amount = $years; $unit = ' year'; if ($years 1) { $unit.= 's '; } } elseif ($months 0) { $amount = $months; $unit = ' month'; if ($months 1) { $unit.= 's '; } } elseif ($weeks 0) { $amount = $weeks; $unit = ' week'; if ($weeks 1) { $unit.= 's '; } } elseif ($days 0) { $amount = $days; $unit = ' day'; if ($days 1) { $unit.= 's '; } } elseif ($hours 0) { $amount = $hours; $unit = ' hour'; if ($hours 1) { $unit.= 's '; } } elseif ($minutes 0) { $amount = $minutes; $unit = ' minute'; if ($minutes 1) { $unit.= 's '; } } elseif ($seconds 0) { $amount = $seconds; $unit = ' second'; if ($seconds 1) { $unit.= 's '; } } return $amount.$unit; } $posted = ; // some timestamp in the past $now = time(); // as current as possible $diff = ($now - $posted); echo posted .time_to_units($diff). ago; I hope this helps ;-) -- Aschwin Wesselius /'What you would like to be done to you, do that to the other'/
[PHP] difference in time
hi to all! on one eZine site, I have to show when the article is posted but as difference from NOW. like posted 32 minutes ago, or posted 5 days ago. is there already sucha php/mysql function? thanks. -ll - Never miss a thing. Make Yahoo your homepage.
[PHP] Difference between 2 time entries
Morning all, I am looking to get the differnce in hours / minutes between 2 values. Currently I have 2 time entries being retruned from mysql, one which is a start time and the other which is a finish time. So $start = '13:12:17'; $finish = '23:12:17'; How would one get the differnce between these 2 times?? I have looked at using the following but am not to sure function timeDiff($firstTime,$lastTime) { // convert to unix timestamps $firstTime=strtotime($firstTime); $lastTime=strtotime($lastTime); // perform subtraction to get the difference (in seconds) between times $timeDiff=$lastTime-$firstTime; // return the difference return $timeDiff; } //Usage : echo timeDiff($start,$finish); Thanks Chris -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Difference between 2 time entries
Chris Grigor a écrit : Morning all, I am looking to get the differnce in hours / minutes between 2 values. Currently I have 2 time entries being retruned from mysql, one which is a start time and the other which is a finish time. So $start = '13:12:17'; $finish = '23:12:17'; How would one get the differnce between these 2 times?? IMHO, the best is to generate a timestamp using mktime for each date. you can the calculate the difference of timestamps and convert it back using date. $tm_start = mktime(substr($start,0,2),substr($start,3,2), substr($start,5,2)); $tm_finish = mktime(substr($finish,0,2),substr($finish,3,2), substr($finish,5,2)); $tm_diff = $tm_finish -tm_start; print date(H:i,$tm_diff); I don't know if date accepts negative timestamps, so be sure $finish is later than $start (you can also put the day in case $finish = 00:00:12 and $start =15:00:00). hope this'll help N F I have looked at using the following but am not to sure function timeDiff($firstTime,$lastTime) { // convert to unix timestamps $firstTime=strtotime($firstTime); $lastTime=strtotime($lastTime); // perform subtraction to get the difference (in seconds) between times $timeDiff=$lastTime-$firstTime; // return the difference return $timeDiff; } //Usage : echo timeDiff($start,$finish); Thanks Chris Nicolas Figaro http://www.sdv.fr [EMAIL PROTECTED] mailto:[EMAIL PROTECTED] SDV plurimédia -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Difference between 2 time entries
Morning all, I am looking to get the differnce in hours / minutes between 2 values. Currently I have 2 time entries being retruned from mysql, one which is a start time and the other which is a finish time. So $start = '13:12:17'; $finish = '23:12:17'; How would one get the differnce between these 2 times?? I have looked at using the following but am not to sure function timeDiff($firstTime,$lastTime) { // convert to unix timestamps $firstTime=strtotime($firstTime); $lastTime=strtotime($lastTime); // perform subtraction to get the difference (in seconds) between times $timeDiff=$lastTime-$firstTime; // return the difference return $timeDiff; } //Usage : echo timeDiff($start,$finish); Thanks Chris -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Difference between 2 time entries
|Found this on the PHP web site, you can add the conversions as the first lines in the functions. function callDuration($dateTimeBegin,$dateTimeEnd) { $dif=$dateTimeEnd - $dateTimeBegin; $hours = floor($dif / 3600); $temp_remainder = $dif - ($hours * 3600); $minutes = floor($temp_remainder / 60); $temp_remainder = $temp_remainder - ($minutes * 60); $seconds = $temp_remainder; // leading zero's - not bothered about hours $min_lead=':'; if($minutes =9) $min_lead .= '0'; $sec_lead=':'; if($seconds =9) $sec_lead .= '0'; // difference/duration returned as Hours:Mins:Secs e.g. 01:29:32 return $hours.$min_lead.$minutes.$sec_lead.$seconds; } | Chris Grigor wrote: Morning all, I am looking to get the differnce in hours / minutes between 2 values. Currently I have 2 time entries being retruned from mysql, one which is a start time and the other which is a finish time. So $start = '13:12:17'; $finish = '23:12:17'; How would one get the differnce between these 2 times?? I have looked at using the following but am not to sure function timeDiff($firstTime,$lastTime) { // convert to unix timestamps $firstTime=strtotime($firstTime); $lastTime=strtotime($lastTime); // perform subtraction to get the difference (in seconds) between times $timeDiff=$lastTime-$firstTime; // return the difference return $timeDiff; } //Usage : echo timeDiff($start,$finish); Thanks Chris -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Difference between 2 time entries
At 1:51 PM +0200 7/20/06, nicolas figaro wrote: IMHO, the best is to generate a timestamp using mktime for each date. you can the calculate the difference of timestamps and convert it back using date. $tm_start = mktime(substr($start,0,2),substr($start,3,2), substr($start,5,2)); $tm_finish = mktime(substr($finish,0,2),substr($finish,3,2), substr($finish,5,2)); $tm_diff = $tm_finish -tm_start; print date(H:i,$tm_diff); I don't know if date accepts negative timestamps, so be sure $finish is later than $start (you can also put the day in case $finish = 00:00:12 and $start =15:00:00). hope this'll help N F NF: Not quite. Your: substr($start,5,2) should be: substr($start,6,2) Your: $tm_diff = $tm_finish -tm_start; Should be: $tm_diff = $tm_finish - $tm_start; And lastly, print date(H:i,$tm_diff); Doesn't print the hours and seconds that have elapsed. I thought that php had a function where you could send it a number of seconds and it would return the number of years, months, days, hours and seconds, but I couldn't find any. But, date() doesn't. tedd -- http://sperling.com http://ancientstones.com http://earthstones.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Difference between 2 time entries
At 12:41 PM +0200 7/20/06, Chris Grigor wrote: Morning all, I am looking to get the differnce in hours / minutes between 2 values. Currently I have 2 time entries being retruned from mysql, one which is a start time and the other which is a finish time. So $start = '13:12:17'; $finish = '23:12:17'; How would one get the differnce between these 2 times?? I have looked at using the following but am not to sure function timeDiff($firstTime,$lastTime) { // convert to unix timestamps $firstTime=strtotime($firstTime); $lastTime=strtotime($lastTime); // perform subtraction to get the difference (in seconds) between times $timeDiff=$lastTime-$firstTime; // return the difference return $timeDiff; } //Usage : echo timeDiff($start,$finish); Chris: You're about there, you have the seconds, just add this: $hours = floor($timeDiff/3600); $timeDiff = $timeDiff - ($hours * 3600); $minutes = floor($timeDiff/60); $timeDiff = $timeDiff - ($minutes * 60); $seconds = $timeDiff; echo($hours); echo(br/); echo($minutes); echo(br/); echo($seconds); I'm surprised that php doesn't have a function to do this -- but maybe I didn't RTFM enough. In any event, hth's 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] difference between require and include
Can anyone tell me the exact differeneces between require and include? -- name balachandar muruganantham/name Yahoo! mbchandar/Yahoo! Hotmail mbchandar/Hotmail blog http://chandar.blogspot.com/blog webhttp://www.balachandar.net/web talk http://www.expertstalk.org/talk shophttp://www.chennaishopping.com/shop -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] difference between require and include
http://ca.php.net/manual/en/function.include.php On 1/20/06, balachandar muruganantham [EMAIL PROTECTED] wrote: Can anyone tell me the exact differeneces between require and include? -- name balachandar muruganantham/name Yahoo! mbchandar/Yahoo! Hotmail mbchandar/Hotmail blog http://chandar.blogspot.com/blog webhttp://www.balachandar.net/web talk http://www.expertstalk.org/talk shophttp://www.chennaishopping.com/shop -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- Take care... Adam
RE: [PHP] difference between require and include
Check out some info here : http://www.weberdev.com/ViewArticle/440 Sincerely berber Visit the Weber Sites Today, To see where PHP might take you tomorrow. PHP code examples : http://www.weberdev.com PHP Web Logs : http://www.weberblog.com/ PHP MySQL Forums : http://www.weberforums.com/ Learn PHP Playing Trivia http://www.webertrivia.com Web Development Index http://www.weberindex.com Web Templates http://www.webertemplates.com Search for PHP Code from your browser http://toolbar.weberdev.com -Original Message- From: balachandar muruganantham [mailto:[EMAIL PROTECTED] Sent: Saturday, January 21, 2006 3:44 AM To: php; php-install@lists.php.net Subject: [PHP] difference between require and include Can anyone tell me the exact differeneces between require and include? -- name balachandar muruganantham/name Yahoo! mbchandar/Yahoo! Hotmail mbchandar/Hotmail blog http://chandar.blogspot.com/blog webhttp://www.balachandar.net/web talk http://www.expertstalk.org/talk shophttp://www.chennaishopping.com/shop -- 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
[PHP] Difference between --with-... and --enable-... in config.m4 [php-4.3.1]
Hi I created a new extension in php-4.3.1 using the ext_skel script. When I edit the config.m4 file, I see a comment that says 'If your extension references something external, use with' seems rather ambiguous. Its not clear if something external is the UNIX file system, a socket connection to another system, another DSO, or something else. What is the difference between --with-... and --enable-... in config.m4. More importantly, why would I choose one or the other. Thanks in advance. Bruce [EMAIL PROTECTED] _ Learn how to choose, serve, and enjoy wine at Wine @ MSN. http://wine.msn.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Difference between php_flag php_admin_flag
That is not explained in the manual As far as I can tell, the difference (according to the manual) is that one can be overridden by an .htaccess file, while the other cannot Im testing to see how my script is behaving in an environment with safe_mode turned on. In apache's config file, I tried both php_flag and php_admin_flag, and they seem to exibit different behaviour. When using php_admin_flag with safe_mode turned on, php behaves as if it were in a total lock down state. For example, if the script is owned by foo:foo, it will not be able to access a file owned by bar:bar. If I change php_admin_flag to php_flag with safe_mode still on, then php behaves a bit relaxed. Where if a script is owned by foo:foo, will be able to access a file owned by bar:bar im currently running php 4.3.3 on FreeBSD 4.8. Has anyone experienced anything like this??? Thanks -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Difference between php_flag php_admin_flag
On Wednesday 26 November 2003 05:21 pm, Gerard Samuel wrote: That is not explained in the manual As far as I can tell, the difference (according to the manual) is that one can be overridden by an .htaccess file, while the other cannot Im testing to see how my script is behaving in an environment with safe_mode turned on. In apache's config file, I tried both php_flag and php_admin_flag, and they seem to exibit different behaviour. When using php_admin_flag with safe_mode turned on, php behaves as if it were in a total lock down state. For example, if the script is owned by foo:foo, it will not be able to access a file owned by bar:bar. If I change php_admin_flag to php_flag with safe_mode still on, then php behaves a bit relaxed. Where if a script is owned by foo:foo, will be able to access a file owned by bar:bar im currently running php 4.3.3 on FreeBSD 4.8. Has anyone experienced anything like this??? Ok, I found out what was happening on my end.. According to http://us2.php.net/manual/en/configuration.changes.php, php_value only influences PHP_INI_ALL and PHP_INI_PERDIR type directives. safe_mode (according to http://us2.php.net/manual/en/function.ini-set.php) is a PHP_INI_SYSTEM type directive. So for the apache config option to be effective, use php_admin_value for safe_mode -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Difference between equal $_SERVER variables?
Hi list, Just out of curiosity I would like to know if anyone can tell me the difference between some $_SERVER variables that generate the same output (in my test-file at least). For instance, what is the difference between $_SERVER['HTTP_HOST'] and $_SERVER['SERVER_NAME']? Can they generate different output under some circumstances? They're always the same with me. Any recommendations on which to use? I know that $_SERVER['REQUEST_URI'] can differ from 'SCRIPT_NAME' and 'PHP_SELF' (I use 'REQUEST_URI' to see what people were looking for when they hit a 404) but can $_SERVER['SCRIPT_NAME'] and $_SERVER['PHP_SELF'] be different? TIA, -- Ivo Fokkema PHP MySQL programmer Leiden University Medical Centre Netherlands -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
: [PHP] Difference between equal $_SERVERvariables?
$_SERVER['HTTP_HOST'] and $_SERVER['SERVER_NAME']are different in my circumstance,I found that the $_SERVER['SERVER_NAME']is the same with the ServerName value you set in httpd.conf. Ivo Fokkema I.F.A.C.Fokkem[EMAIL PROTECTED] [EMAIL PROTECTED] [PHP] Difference between equal $_SERVER variables? 2003-07-24 16:20 Hi list, Just out of curiosity I would like to know if anyone can tell me the difference between some $_SERVER variables that generate the same output (in my test-file at least). For instance, what is the difference between $_SERVER['HTTP_HOST'] and $_SERVER['SERVER_NAME']? Can they generate different output under some circumstances? They're always the same with me. Any recommendations on which to use? I know that $_SERVER['REQUEST_URI'] can differ from 'SCRIPT_NAME' and 'PHP_SELF' (I use 'REQUEST_URI' to see what people were looking for when they hit a 404) but can $_SERVER['SCRIPT_NAME'] and $_SERVER['PHP_SELF'] be different? TIA, -- Ivo Fokkema PHP MySQL programmer Leiden University Medical Centre Netherlands -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Difference between equal $_SERVER variables?
server name - real name of the server, ie when you do a reverse dns lookup you get (usualy) this http host - content of the Host: header, that is virtual host Ivo Fokkema wrote: Hi list, Just out of curiosity I would like to know if anyone can tell me the difference between some $_SERVER variables that generate the same output (in my test-file at least). For instance, what is the difference between $_SERVER['HTTP_HOST'] and $_SERVER['SERVER_NAME']? Can they generate different output under some circumstances? They're always the same with me. Any recommendations on which to use? I know that $_SERVER['REQUEST_URI'] can differ from 'SCRIPT_NAME' and 'PHP_SELF' (I use 'REQUEST_URI' to see what people were looking for when they hit a 404) but can $_SERVER['SCRIPT_NAME'] and $_SERVER['PHP_SELF'] be different? TIA, -- Ivo Fokkema PHP MySQL programmer Leiden University Medical Centre Netherlands -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Difference between equal $_SERVER variables?
* Thus wrote Ivo Fokkema ([EMAIL PROTECTED]): Hi list, Just out of curiosity I would like to know if anyone can tell me the difference between some $_SERVER variables that generate the same output (in my test-file at least). For instance, what is the difference between $_SERVER['HTTP_HOST'] and $_SERVER['SERVER_NAME']? Can they generate different output under some circumstances? They're always the same with me. Any recommendations on which to use? I know that $_SERVER['REQUEST_URI'] can differ from 'SCRIPT_NAME' and 'PHP_SELF' (I use 'REQUEST_URI' to see what people were looking for when they hit a 404) but can $_SERVER['SCRIPT_NAME'] and $_SERVER['PHP_SELF'] be different? I would suggest reading up on the variables available http://www.php.net/manual/en/reserved.variables.php That will answer all your questions. Curt -- I used to think I was indecisive, but now I'm not so sure. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Difference between equal $_SERVER variables?
Curt Zirzow [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] * Thus wrote Ivo Fokkema ([EMAIL PROTECTED]): Hi list, Just out of curiosity I would like to know if anyone can tell me the difference between some $_SERVER variables that generate the same output (in my test-file at least). I would suggest reading up on the variables available http://www.php.net/manual/en/reserved.variables.php Well, I've seen that, but for instance; 'PHP_SELF' The filename of the currently executing script, relative to the document root. --and-- 'SCRIPT_NAME' Contains the current script's path. doesn't mean much to me... They both return the same results to me, also. When do these differ? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Difference between $_POST[foo] and $_POST['foo']?
Hi A quickie, how does the $_POST[foo] and $_POST['foo'] differ? Both do work. BR, Jarmo -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Difference between $_POST[foo] and $_POST['foo']?
on 17/06/03 6:09 PM, Jarmo Järvenpää ([EMAIL PROTECTED]) wrote: Hi A quickie, how does the $_POST[foo] and $_POST['foo'] differ? Both do work. $_POST[foo] will look for a pre defined constant foo. Under certain error-reporting levels, this will generate an notice/warning, and it assumes you mean 'foo'. $_POST['foo'] is correct, and will not generate errors. Justin -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] difference twixt mod_php_memory_usage and top size/res
I'm trying to get reliable values for memory usage on my php scripts, some of which are making big pdfs using PDFlib. I've set up a CustomLog in my apache config file using the PHP memory usage note to apache and I'm trying to understand the discrepancies between the peak memory usage value logged via %{mod_php_memory_usage}n and the values that are displayed via SIZE and RES when using the unix command top. EXAMPLES of mod_php_memory_usage VS top: php_log_peak_mem top(SIZE) top(RES) 72408 12404K 7156K 371464 12404K 7900K 45240 12576K 8160K 126112 12452K 7968K 1073304 13840K 9596K 2678008 17620K12724K 3094000 18796K13892K I've had a hard time finding resources to perform proper testing and capacity planning for my Virtual Private Server hosting setup. For the most part, I've been successful getting some guidelines with load testing using JMeter but I've been requested to provide some sort of outlook on my scripts memory consumption and how that translates into scaling numbers of concurrent users. Any info on the reliability of utilizing the top command would be helpful because I have some non-php CGI scripts that I need to track as well. It's easy to throw hardware/memory/money at things but I'd like to provide options that are sensible and affordable AND have the reasons why changes are necessary. The big question: Why is there a difference and what is the difference between the figures logged by mod_php_memory_usage and the numbers reported by the SIZE and RES columns of the top command? Any suggestions on how I can get up to speed on planning server requirements around my existing scripts would be extremely helpful as well. (Useful testing experts/how-to's/books/websites etc.) Thanks much. Eric -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Difference between months
How do I subtract the difference of months between two dates? For instance, if one date is 2003-12 and the other is 2002-08, I need to know that there are 16 months between them. If one date is 2003-04 and the other is 2003-01, I need to know that there are 3 months between them. How can I do this? One way... $date1 = 2003-12; $date2 = 2002-08; $d1 = explode('-',$date1); $d2 = explode('-',$date2); $diff = ($d1[0]*12+$d1[1]) - ($d2[0]*12+$d2[1]); ---John W. Holmes... PHP Architect - A monthly magazine for PHP Professionals. Get your copy today. http://www.phparch.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Difference between
At 05:54 08.03.2003, James Taylor said: [snip] Ok, this may have already been posted to the list already, but the archives don't seem to like the and characters. I'm running into some code that looks like this: snip Define('INPUT', 2); snip if($search-level INPUT) $tmp.= $search-input(); Ok, what's the mean? As far as I could tell from the very little documentation I was able to scrape up on google, is a bit-by-bit operator. Thus, if either INPUT or $search-level, we get TRUE... If that's the case, what's the point of using it instead of || ? [snip] These are two totally different operators: - bitwise AND - logical AND So: 5 2 yields true 5 2 yields 0 In your example we would need to know the value of INPUT - it is most certainly one of 1, 2, 4, 8, etc, denoting a single bit. So the expression $search-level INPUT would yield nonzero (a.k.a. true) if the bit denoted by INPUT was set in $search-level. -- O Ernest E. Vogelsinger (\)ICQ #13394035 ^ http://www.vogelsinger.at/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Difference between
Ok, this may have already been posted to the list already, but the archives don't seem to like the and characters. I'm running into some code that looks like this: snip Define('INPUT', 2); snip if($search-level INPUT) $tmp.= $search-input(); Ok, what's the mean? As far as I could tell from the very little documentation I was able to scrape up on google, is a bit-by-bit operator. Thus, if either INPUT or $search-level, we get TRUE... If that's the case, what's the point of using it instead of || ? Or, do I just totally not understand the point of this. Thanks -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Difference between
On March 7, 2003 08:54 pm, James Taylor wrote: Ok, this may have already been posted to the list already, but the archives don't seem to like the and characters. I'm running into some code that looks like this: snip Define('INPUT', 2); snip if($search-level INPUT) $tmp.= $search-input(); Ok, what's the mean? As far as I could tell from the very little documentation I was able to scrape up on google, is a bit-by-bit operator. Thus, if either INPUT or $search-level, we get TRUE... If that's the case, what's the point of using it instead of || ? Or, do I just totally not understand the point of this. Thanks Ok shoot me if I'm wrong here I just vaguely recall this from some Java course I took. I think and are identical except that if you use , PHP will not short circuit the expression. like: $x = 0; if(false $x++) print impossible; print $x; // should print 0 $x = 0; if(false $x++) print impossible; print $x; // should print 1 Warning: This may only work for Java or maybe I just can't remember it properly.. leo -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] difference between shared and /usr/bin/mysql
Hi, When compiling PHP what is the difference between these two : ./configure --with-mysql=shared ./configure --with-mysql=/usr/bin/mysql What are the advantages/disadvatages of using either. thx g -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Difference between 2 Dates
I found this code on the php.net web site but am new to php and can't figure out how to dispaly the difference once calucuated. Belowis the code I'm using: # --- Date Difference --- #Date 1 from MySQL database recordset row $date1 = $row_rsMESSAGES['privmsgs_date']; #Date 2 - now $date2 = date(ymd H:is); #function function date_diff($date1, $date2) { $s = strtotime($date2)-strtotime($date1); $d = intval($s/86400); $s -= $d*86400; $h = intval($s/3600); $s -= $h*3600; $m = intval($s/60); $s -= $m*60; return array(d=$d,h=$h,m=$m,s=$s); } #what I thought would dispaly the diffence but returns and error. echo date_diff($m, $d, $h, $m); Thanks -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Fw: [PHP] Difference between 2 Dates
Oh dear. In what format are you storing the date in your database? If you can convert what you have into UNIX EPOCH then you can simply subtract your date against mktime(); then echo the result through getdate() and be done with it in three lines of code. -Kevin - Original Message - From: vernon [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Friday, December 13, 2002 12:43 PM Subject: [PHP] Difference between 2 Dates I found this code on the php.net web site but am new to php and can't figure out how to dispaly the difference once calucuated. Belowis the code I'm using: # --- Date Difference --- #Date 1 from MySQL database recordset row $date1 = $row_rsMESSAGES['privmsgs_date']; #Date 2 - now $date2 = date(ymd H:is); #function function date_diff($date1, $date2) { $s = strtotime($date2)-strtotime($date1); $d = intval($s/86400); $s -= $d*86400; $h = intval($s/3600); $s -= $h*3600; $m = intval($s/60); $s -= $m*60; return array(d=$d,h=$h,m=$m,s=$s); } #what I thought would dispaly the diffence but returns and error. echo date_diff($m, $d, $h, $m); Thanks -- 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] Difference between 2 Dates
I have a similar problem. I am trying to figure out which of two dates is greater. Both are in the -mm-dd format. Is there any easy function that allows this sort of comparison or am I missing something? On Friday, December 13, 2002, at 01:43 PM, vernon wrote: I found this code on the php.net web site but am new to php and can't figure out how to dispaly the difference once calucuated. Belowis the code I'm using: # --- Date Difference --- #Date 1 from MySQL database recordset row $date1 = $row_rsMESSAGES['privmsgs_date']; #Date 2 - now $date2 = date(ymd H:is); #function function date_diff($date1, $date2) { $s = strtotime($date2)-strtotime($date1); $d = intval($s/86400); $s -= $d*86400; $h = intval($s/3600); $s -= $h*3600; $m = intval($s/60); $s -= $m*60; return array(d=$d,h=$h,m=$m,s=$s); } #what I thought would dispaly the diffence but returns and error. echo date_diff($m, $d, $h, $m); Thanks -- 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] Difference between 2 Dates
Again the solution is to convert the dates into timestamps for easy comparison. In your case you can use the strtotime() function. I believe that -mm-dd is a standard date format that the function will recognize, is it not? $ts1 = strtotime($date1); $ts2 = strtotime($date2); if ($ts1 $ts2) { // .. blah blah blah. } -Kevin - Original Message - From: Colin Bossen [EMAIL PROTECTED] To: vernon [EMAIL PROTECTED] Cc: [EMAIL PROTECTED] Sent: Friday, December 13, 2002 2:50 PM Subject: Re: [PHP] Difference between 2 Dates I have a similar problem. I am trying to figure out which of two dates is greater. Both are in the -mm-dd format. Is there any easy function that allows this sort of comparison or am I missing something? On Friday, December 13, 2002, at 01:43 PM, vernon wrote: I found this code on the php.net web site but am new to php and can't figure out how to dispaly the difference once calucuated. Belowis the code I'm using: # --- Date Difference --- #Date 1 from MySQL database recordset row $date1 = $row_rsMESSAGES['privmsgs_date']; #Date 2 - now $date2 = date(ymd H:is); #function function date_diff($date1, $date2) { $s = strtotime($date2)-strtotime($date1); $d = intval($s/86400); $s -= $d*86400; $h = intval($s/3600); $s -= $h*3600; $m = intval($s/60); $s -= $m*60; return array(d=$d,h=$h,m=$m,s=$s); } #what I thought would dispaly the diffence but returns and error. echo date_diff($m, $d, $h, $m); Thanks -- 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 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Difference between 2 Dates
Colin, I have a similar problem. I am trying to figure out which of two dates is greater. Both are in the -mm-dd format. Is there any easy function that allows this sort of comparison or am I missing something? Treat the dates as strings not numbers: $DateOne = 2002-12-13; $DateTwo = 2001-11-12; if ( $DateOne = $DateTwo ) echo DateOne comes first; You can do comparisons like this but don't try any 'arithmetic'! Regards, =dn -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Difference between 2 Dates
On Fri, 13 Dec 2002, Colin Bossen wrote: I have a similar problem. I am trying to figure out which of two dates is greater. Both are in the -mm-dd format. Is there any easy function that allows this sort of comparison or am I missing something? You have a simpler problem. -mm-dd is the ISO format, and one of the reasons it is a great format is, you can sort it any way you like, and it just works. So the simplest way to do it is to compare strings in alphabetic order: if($a$b) echo $a earlier than $b\n; else echo $b earlier than $a\n; Cheers, Jean-Marc Libs -- Give a man a fish and he will eat for a day. Teach a man to fish and he will sit in a boat drinking beer all day. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Difference between 2 Dates
I'm trying to do a mail function where if the date the email was posted was today then a new message would display, otherwise not. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Difference between $object = new Class and $object = new Class
Hi, I'm using a 3rd pary debug class (ErrorHandler - http://www.phpclasses.org/browse.html/package/345.html) in this project I'm working on. For this ErrorHandler class to work it just needs to be instantiated at the beginning of a php file and it will catch the errors, warnings and notices. But I found out that this only functions when instantiating like this: $errorH = new ErrorHandler; and it doesn't work when you do this: $errorH = new ErrorHandler; I find this very awkward because: - I don't see the use of a reference when creating a new object. - I don't see why it does NOT work when assigning the object while it DOES work when assigning a reference to the object. Does anyone have a clue why this could be happening?? I'm _very_ curious coz I simply don't get it. 8[ Greetz, Tim -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] difference
What is the difference from using $_GET['some_var'] from using $_REQUEST['some_var']? I think the documentation says either can be used to do the same thing. What is the performance difference from having register_globals turned off from having it turned on? I assume the default was changed for performance reasons? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Difference between executable and Apache server
Good afternoon, We have some cases where we run PHP as a standalone executable for scripting certain processes that can be called from CRON, and we also have PHP for Apache. Does the php.ini affect both? Specifically script times? Thanks! Jay -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Difference between executable and Apache server
On Mon, 8 Jul 2002, Jay Blanchard wrote: We have some cases where we run PHP as a standalone executable for scripting certain processes that can be called from CRON, and we also have PHP for Apache. Does the php.ini affect both? Specifically script times? Check the output of phpinfo() for each and see. You're looking for the line that's tagged Configuration File (php.ini) Path. Usually there are different files for the module and the cgi. (i.e. - the packages from Debian Linux distribution(s) puts separate php.ini files into /etc/php4/apache and /etc/php4/cgi.) g.luck, ~Chris /\ \ / Microsoft Security Specialist: X The moron in Oxymoron. / \ http://www.thebackrow.net -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] difference between $foo and isset($foo)
Hi, I am looking at some codes. Some authors use $foo and isset($foo) interchangeably. Just to want to make sure that the statement, if ($foo) { ... } is different from if (isset($foo)) { ... } Right? if ($foo) means variable exists and can be null. Whereas, isset($foo) means that the value in $foo cannot be null? Regards, Norman -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] difference between $foo and isset($foo)
On Thu, 18 Apr 2002, Norman Zhang wrote: I am looking at some codes. Some authors use $foo and isset($foo) interchangeably. Just to want to make sure that the statement, if ($foo) { ... } is different from if (isset($foo)) { ... } Right? if ($foo) means variable exists and can be null. Whereas, isset($foo) means that the value in $foo cannot be null? Not quite (or maybe I just don't understand your sentence). if ($foo) will be true if $foo has been set to some non-null (and non-zero) value. It will be false if $foo==null. On the other hand, if (isset($foo)) will be true will be true if any value at all has been assigned to $foo, including null or zero. It will only be false if $foo has never been assigned in this scope. However, bear in mind that ($foo) will still evaluate to null even in this case. miguel -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] difference between php3 and php4
Warning: Supplied argument is not a valid MySQL result resource in c:\program files\apache group\apache\cgi-bin\emp.php3 on line 10 $db = mysql_connect(localhost, , ); mysql_select_db(employee,$db); $result = mysql_query(SELECT * FROM employees,$db); echo table border=0; echo tr; echo td bgcolor=#FAFOE6 colspan=2BName/B/td; echo td bgcolor=#FAFOE6BAddress/B/td; echo td bgcolor=#FAFOE6BPosition/B/td; echo /tr; while($row = mysql_fetch_row($result)) { $fname = $row[1]; $lname = $row[2]; $address = $row[3]; $position = $row[4]; echo tr bgcolor=#C6E7DE; echo td$fname/td; echo td$lname/td; echo td$address/td; echo td$position/td; echo /tr; } This script works in php3 but not in windows php4. The error message above points to the mysql_fetch_row function. Does this function work differently in php4? If not, what else might cause this script to work in php3 and not in php4? __ Do You Yahoo!? Yahoo! Sports - Coverage of the 2002 Olympic Games http://sports.yahoo.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Difference between two dates
Uma Shankari T. [EMAIL PROTECTED] wrote: If i gave the str date as 31-01-2001; and $str1=04-02-2001; then it is displaying the wrong result Plz tell me how can i rectify this problem... Uma, I wrote a function last year that calculates the time between 2 dates in whatever unit is preferred (everything from seconds to years). My function expects the date in a slightly different format, but it would be trivial to switch the order of the date parts in one line and hard-code something for the hours, minutes and seconds it expects in the date format. It wouldn't matter what you hardcode them as since it would use the same time of day for both dates. http://www.befriend.com/code_gallery/php/get_elapsed_time/ -- Steve Werby President, Befriend Internet Services LLC http://www.befriend.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Difference between two dates
Hello, I got the solution for the date difference problem..,, Thankyou very much. -Uma Uma Shankari T. [EMAIL PROTECTED] wrote: If i gave the str date as 31-01-2001; and $str1=04-02-2001; then it is displaying the wrong result Plz tell me how can i rectify this problem... Uma, I wrote a function last year that calculates the time between 2 dates in whatever unit is preferred (everything from seconds to years). My function expects the date in a slightly different format, but it would be trivial to switch the order of the date parts in one line and hard-code something for the hours, minutes and seconds it expects in the date format. It wouldn't matter what you hardcode them as since it would use the same time of day for both dates. http://www.befriend.com/code_gallery/php/get_elapsed_time/ -- Steve Werby President, Befriend Internet Services LLC http://www.befriend.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Difference between two dates
Hello, How can i find out the difference between two dates. I am having the date like this $str=10-01-2001; $str1=01-02-2002; I need to find out the difference between the date,month and year. If anyone know the solution for this problem plz tell me -Uma -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Difference between two dates
Read this article at PHPbuilder: http://www.phpbuilder.com/columns/akent2610.php3 - D - Original Message - From: Uma Shankari T. [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Tuesday, February 19, 2002 9:50 AM Subject: [PHP] Difference between two dates Hello, How can i find out the difference between two dates. I am having the date like this $str=10-01-2001; $str1=01-02-2002; I need to find out the difference between the date,month and year. If anyone know the solution for this problem plz tell me -Uma -- 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] Difference between two dates
Try this : $d1=strtotime('d-m-Y',$str); $d2=strtotime('d-m-Y',$str1); var_dump($d2-$d1); Best regards, Andrey Hristov - Original Message - From: Uma Shankari T. [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Tuesday, February 19, 2002 10:50 AM Subject: [PHP] Difference between two dates Hello, How can i find out the difference between two dates. I am having the date like this $str=10-01-2001; $str1=01-02-2002; I need to find out the difference between the date,month and year. If anyone know the solution for this problem plz tell me -Uma -- 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] Difference between two dates
Hello, If i executed code then nothing will be displayed... -Uma On Tue, 19 Feb 2002, Andrey Hristov wrote: AHTry this : AH$d1=strtotime('d-m-Y',$str); AH$d2=strtotime('d-m-Y',$str1); AHvar_dump($d2-$d1); AH AH AHBest regards, AHAndrey Hristov AH AH- Original Message - AHFrom: Uma Shankari T. [EMAIL PROTECTED] AHTo: [EMAIL PROTECTED] AHSent: Tuesday, February 19, 2002 10:50 AM AHSubject: [PHP] Difference between two dates AH AH AH AH AH Hello, AH AH How can i find out the difference between two dates. AH AH I am having the date like this AH AH $str=10-01-2001; AH $str1=01-02-2002; AH AH I need to find out the difference between the date,month and year. AH AH If anyone know the solution for this problem plz tell me AH AH AH -Uma AH AH AH -- AH PHP General Mailing List (http://www.php.net/) AH To unsubscribe, visit: http://www.php.net/unsub.php AH AH AH -- Love and you shall be loved by others -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Difference between two dates
Hello, How can i find out the difference between two dates. I am having the date like this $str=10-01-2001; $str1=01-02-2002; I need to find out the difference between the date,month and year. If anyone know the solution for this problem plz tell me -Uma -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Difference between two dates
This will give you the difference between the two dates in seconds: $diff = strtotime(str_replace('-','/',$str1)) - strtotime(str_replace('-','/',$str)); -Rasmus On Wed, 20 Feb 2002, Uma Shankari T. wrote: Hello, How can i find out the difference between two dates. I am having the date like this $str=10-01-2001; $str1=01-02-2002; I need to find out the difference between the date,month and year. If anyone know the solution for this problem plz tell me -Uma -- 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] Difference between two dates
You can convert the time into seconds using mktime(), subtract one from the other, and then reformat it using gmstrftime: //int mktime ( int hour, int minute, int second, int month, int day, int year [, int is_dst]) //string gmstrftime ( string format [, int timestamp]) ? $time1 = mktime (0,0,0,12,32,1997); $time2 = mktime (0,0,0,12,31,1995); $dif = $time1 - $time2; $new_time = gmstrftime(%b %d %Y, $dif); echo $time1br; echo $time2br; echo $difbr; echo $new_timebr; ? The output looks like this: 883641600 820396800 63244800 Jan 03 1972 Of course you will have to get the date out of the current format you have it, but that shouldn't be too hard using explode() and implode(); Steven J. Walker Walker Effects www.walkereffects.com [EMAIL PROTECTED] On Tuesday, February 19, 2002, at 06:51 PM, Uma Shankari T. wrote: Hello, How can i find out the difference between two dates. I am having the date like this $str=10-01-2001; $str1=01-02-2002; I need to find out the difference between the date,month and year. If anyone know the solution for this problem plz tell me -Uma -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Difference between two dates
If i gave the str date as 31-01-2001; and $str1=04-02-2001; then it is displaying the wrong result Plz tell me how can i rectify this problem... -Uma On Tue, 19 Feb 2002, Rasmus Lerdorf wrote: RLThis will give you the difference between the two dates in seconds: RL RL$diff = strtotime(str_replace('-','/',$str1)) - strtotime(str_replace('-','/',$str)); RL RL-Rasmus RL RLOn Wed, 20 Feb 2002, Uma Shankari T. wrote: RL RL RL RL RL Hello, RL RL How can i find out the difference between two dates. RL RL I am having the date like this RL RL $str=10-01-2001; RL $str1=01-02-2002; RL RL I need to find out the difference between the date,month and year. RL RL If anyone know the solution for this problem plz tell me RL RL RL -Uma RL RL RL RL -- RL PHP General Mailing List (http://www.php.net/) RL To unsubscribe, visit: http://www.php.net/unsub.php RL RL -- Love and you shall be loved by others -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Difference between vpopmail_add_domain AND vpopmail_add_domain_ex
Hi, where's the difference between the Popmail vpopmail_add_domain AND vpopmail_add_domain_ex?? Do you have to make vpopmail_add_domain first, before you make vpopmail_add_domain_ex? Thanx, -- Mit freundlichem Gruß, Johannes Tyra -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Difference between cookie and session
We had a discussion this morning in our office on the differences between cookie and session. I just would like to ask the body if your could enlighten me more on this. And another thing, can cookie be a carrier of some virus across the internet? Thanks, Ryan
[PHP] difference !!??
Hello, What's the difference between: 1.- $row[column_name]; 2.- $row['column_name']; 3.- $row[column_name]; ? ragards Bart -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] difference !!??
Ok, 1 is IMO not correct, a string should be quoted. 2 and 3 make no practical difference in this situation, although 2 is probably somewhat faster because PHP doesn't substitute variables with their value when they're within single quotes. for code readability it is probaby best if you always use double quotes, and only if it saves a whole lot of escaping $'s and double quotes within the string use single quotes. note that if you like to include both single and double quotes in a long string (HTML for example) but still want to be able to use variables in it, you can use 'heredoc notation'. bvr. On Thu, 7 Feb 2002 10:05:18 +0100, B. Verbeek wrote: Hello, What's the difference between: 1.- $row[column_name]; 2.- $row['column_name']; 3.- $row[column_name]; -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Difference between i586 RPM and SRC.RPM?
Wanted to download PHP 4.1.1 RPM. What's the difference between i586 RPM and SRC.RPM? What sites provide non-FTP download for PHP4.1.1 RPM? Thanx ppl! _ Get your FREE download of MSN Explorer at http://explorer.msn.com/intl.asp. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Difference of queries in PHP/mySQL?
Check the return value of mysql_query(). It should either evaluate to false, or true. If false, then output some error messages using mysql_error() and mysql_errno(). -JasonGarber IonZoftDotCom At 01:29 PM 11/17/2001 -0500, Jeff Lewis wrote: I am wondering if there are any difference between using PHP and using the command line for mySQL. Entering this at the comman line returns all the membergroups properly. When I use this in my PHP program, it doesn't continue past this line: $request = mysql_query(SELECT membergroup FROM membergroups WHERE 1 ORDER BY ID_GROUP); Jeff -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] Difference of queries in PHP/mySQL?
I am wondering if there are any difference between using PHP and using the command line for mySQL. Entering this at the comman line returns all the membergroups properly. When I use this in my PHP program, it doesn't continue past this line: $request = mysql_query(SELECT membergroup FROM membergroups WHERE 1 ORDER BY ID_GROUP); Jeff -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Difference of queries in PHP/mySQL?
are you actually doing anything with $request? that just gets a mysql result back in a variable, you then have to extract the data from it... Jeff Lewis wrote: I am wondering if there are any difference between using PHP and using the command line for mySQL. Entering this at the comman line returns all the membergroups properly. When I use this in my PHP program, it doesn't continue past this line: $request = mysql_query(SELECT membergroup FROM membergroups WHERE 1 ORDER BY ID_GROUP); Jeff -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP] difference between ?php and ?
There isn't any difference, if your php.ini settings allow it (short_tags, I believe), you can use ? instead of ?php -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] Sent: Sunday, September 09, 2001 2:43 PM To: [EMAIL PROTECTED] Subject: [PHP] difference between ?php and ? Hi, I am a newbie at this PHP thing and I have been working from information on the web and from books. I noticed that some start the PHP script with ? and some start with ?php. Actually I have noticed that one of the first PHP script in my book uses both methods interchangeably. Is there a real difference between the two? Or maybe I just haven't noticed something. Peter -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] difference between ?php and ?
The problem comes if you use php to generate xml documents in xml you use the tag ?xml.. if php is setup to handle ? then it takes that then throws a parse error as it attempts to read the xml bit. Simplest solution if you are using php to generate xml tags is to always use php to generate those.. ie echo('?xml'); works fine - Original Message - From: Matthew Loff [EMAIL PROTECTED] To: [EMAIL PROTECTED]; [EMAIL PROTECTED] Sent: Sunday, September 09, 2001 8:05 PM Subject: RE: [PHP] difference between ?php and ? There isn't any difference, if your php.ini settings allow it (short_tags, I believe), you can use ? instead of ?php -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] Sent: Sunday, September 09, 2001 2:43 PM To: [EMAIL PROTECTED] Subject: [PHP] difference between ?php and ? Hi, I am a newbie at this PHP thing and I have been working from information on the web and from books. I noticed that some start the PHP script with ? and some start with ?php. Actually I have noticed that one of the first PHP script in my book uses both methods interchangeably. Is there a real difference between the two? Or maybe I just haven't noticed something. Peter -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]