Re: [PHP] Newbie - is there a function similar to the sql 'like' comparison operator?

2008-05-08 Thread Kalle Sommer Nielsen

Hi RevDave

Theres the similar_text() function which calculates the procentage of te 
similarity between

two strings.

If your looking for a check to see if a string has some specified text then 
use the strpos()
function and then the identical comparison operator to check for true and 
false



Kalle Sommer Nielsen
DR - www.dr.dk

- Original Message - 
From: revDAVE [EMAIL PROTECTED]

To: PHP General php-general@lists.php.net
Sent: Thursday, May 08, 2008 5:20 PM
Subject: [PHP] Newbie - is there a function similar to the sql 'like' 
comparison operator?



Newbie - is there a function similar to the sql 'like' comparison 
operator?


I would like to be able to compare 2 strings:

If $this ---*like or similar to*--- $that

That type of thing...


I know of this page:

http://us3.php.net/manual/sl/language.operators.comparison.php


But I don't see something 'like' or 'similar' to something else


--
Thanks - RevDave
Cool @ hosting4days . com
[db-lists]




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





--
No virus found in this incoming message.
Checked by AVG.
Version: 7.5.524 / Virus Database: 269.23.10/1421 - Release Date: 
07-05-2008 17:23






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



Re: [PHP] the Y2K38 BUG

2008-05-07 Thread Kalle Sommer Nielsen

Quoting Jon L. [EMAIL PROTECTED]:


Another possibility...
Port the Date object implementation from ECMA/Javascript.
It has a range of +/-8.64e15, or Tue, 20 Apr -271821 00:00:00 GMT to Sat, 13
Sep 275760 00:00:00 GMT.

You know...just to have a little extra time to find something else. ;)

- Jon L.


That would be a quite interesting move, try propose it to Derick ;)



On Wed, May 7, 2008 at 12:56 AM, Paul Scott [EMAIL PROTECTED] wrote:



On Tue, 2008-05-06 at 23:50 -0600, Nathan Nobbe wrote:
 true-that ;)
 anyway, the DateTime class is implemented as a 64-bit unsigned (i think)
 value.  so if you use it you should be good to go.

 php  echo date_create('2040-10-24')-format('M-d-Y');
 Oct-24-2040


a 64bit unsigned int is best, but that would only work properly on 64bit
arch. For 32bit users, making it unsigned is the best option for now,
and I suppose that by 2038 there will be another option.

As far as I am concerned, this discussion is a discussion for the sake
of discussion. If I am still using the same apps that I use today in
2038, I will officially rethink my usefulness as a human being :)

--Paul


All Email originating from UWC is covered by disclaimer
http://www.uwc.ac.za/portal/public/portal_services/disclaimer.htm


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






Kalle Sommer Nielsen
Danmarks Radio - www.dr.dk


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



Re: [PHP] problem imap_headerinfo

2008-04-30 Thread Kalle Sommer Nielsen

Hi Richard

Like Chris replied, then the returned value of imap_headerinfo() is an 
stdClass object. You can iterate though

all the object properties like this:
$header = '';

foreach($mail_head as $headerbit = $value)
{
   if(empty($value))
   {
   continue;
   }

   $header .= $headerbit . ': ' . $value . \r\n;
}

and then:
echo $header;

You might wanna change the $headerbit to look abit more readable =)

Cheers,
Kalle

- Original Message - 
From: Richard Kurth [EMAIL PROTECTED]

To: PHP General List php-general@lists.php.net
Sent: Thursday, May 01, 2008 5:05 AM
Subject: [PHP] problem imap_headerinfo


I get a *Catchable fatal error*: Object of class stdClass could not be 
converted to string  on this line  $mail_head = imap_headerinfo($conn, 
$i);
if I remove it it works fine what would be casing this I really need to 
read the header. I am using php version  5.2.5


$conn = @imap_open({ . $bouncer['host'] . : . $bouncer['port'] . / . 
$bouncer['mailtype'] . /notls} . $bouncer['mailbox'], 
$bouncer['username'], $bouncer['password']);

$headers = @imap_headers($conn);
   if ($headers) {
 $email_count = sizeof($headers);
 for($i = 1; $i = $email_count; $i++) {
  # Check the body against all saved patterns
  $mail_head = imap_headerinfo($conn, $i); $mail_body = 
imap_fetchbody($conn, $i, 1);

   echo mail head: $mail_headbr\n;
   echo mail body: $mail_bodybr\n;


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





--
No virus found in this incoming message.
Checked by AVG. Version: 7.5.524 / Virus Database: 269.23.7/1408 - Release 
Date: 30-04-2008 18:10






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