Instead of trim($str), you need:

$str = trim($str);


Justin French



on 22/08/02 12:44 AM, Mike At Spy ([EMAIL PROTECTED]) wrote:

> 
> But isn't taking off characters or spaces considered modifying a string?
> 
> I'll take another look at the manual, thanks.
> 
> -Mike
> 
> 
>> -----Original Message-----
>> From: Darren Gamble [mailto:[EMAIL PROTECTED]]
>> Sent: Wednesday, August 21, 2002 10:32 AM
>> To: 'Mike At Spy'; [EMAIL PROTECTED]
>> Subject: RE: [PHP] Agh! trim (#$@#@^%!!!)
>> 
>> 
>> Good day,
>> 
>> Well, for one, you are discarding the results of trim().
>> 
>> Check out the online manual page for trim().  The trim'ed string is
>> returned.  It does not say it modifies the string it is passed.
>> 
>> ============================
>> Darren Gamble
>> Planner, Regional Services
>> Shaw Cablesystems GP
>> 630 - 3rd Avenue SW
>> Calgary, Alberta, Canada
>> T2P 4L4
>> (403) 781-4948
>> 
>> 
>>> -----Original Message-----
>>> From: Mike At Spy [mailto:[EMAIL PROTECTED]]
>>> Sent: Wednesday, August 21, 2002 7:12 AM
>>> To: [EMAIL PROTECTED]
>>> Subject: RE: [PHP] Agh! trim (#$@#@^%!!!)
>>> 
>>> 
>>> 
>>> Here is the complete code - I have a lot of prints to watch
>>> things as they
>>> happen. $whois is the result of a WHOIS search.
>>> 
>>> 
>>> 
>>> // beginning of my stuff
>>> 
>>> function get_date ($whois){
>>> trim ($whois);
>>> $whoisarray = explode ("\n", $whois);
>>> print_r(array_values ($whoisarray));
>>> 
>>> $total_elements = count ($whoisarray);
>>> 
>>> print "<p><b>$total_elements</b> elements in this array";
>>> 
>>> $ce = 0;
>>> 
>>> while ($ce < $total_elements){
>>> 
>>> $single_line = array_pop ($whoisarray);
>>> 
>>> $expiration = strstr ($single_line,"xpires");
>>> 
>>> if ($expiration != '' || 0) {
>>> 
>>> print "<p><b>This is the line you want!  Line $ce that sez:
>>> $single_line</b><p>";
>>> 
>>> // $single_line = preg_replace (".", " ", $single_line);
>>> 
>>> $single_line = substr($single_line, 0, -2);
>>> 
>>> // $single_line = rtrim ($single_line," \t\s\n\r");
>>> 
>>> $getdatearray = explode (" ", $single_line);
>>> print_r(array_values ($getdatearray));
>>> 
>>> $total_expire_elements = count ($getdatearray);
>>> 
>>> print "<p><br>".$total_expire_elements;
>>> 
>>> $dc = 0;
>>> 
>>> while ($dc < $total_expire_elements){
>>> 
>>> $element = array_pop($getdatearray);
>>> 
>>> $date_dash = strstr($element,"-");
>>> 
>>> if ($date_dash != '' || 0){
>>> 
>>> print "<p><br>First Detection
>>> ".$element;
>>> 
>>> // $trimmed = rtrim ($element," \t.");
>>> 
>>> print "<p><br>Last print before
>>> date function ".$element;
>>> 
>>> month_replace ($element);
>>> 
>>> print "<p><br>Result after function
>>> ".$element."<p><br>";
>>> 
>>> $MySQLDate=date_validate($element);
>>> if (substr($MySQLDate, 0, 5)=="Error") {
>>> // Insert Error Code if you want
>>> } else {
>>> // Insert Valid Date Code if you want
>>> }
>>> 
>>> print "<p>The MySQL Formated date is
>>> $MySQLDate";
>>> 
>>> 
>>> }
>>> else {}
>>> 
>>> $dc++;
>>> 
>>> }
>>> 
>>> 
>>> }
>>> else {}
>>> 
>>> $ce++;
>>> 
>>> }
>>> 
>>> }
>>> // end of my stuff
>>> 
>>> 
>>> Thanks,
>>> 
>>> -Mike
>>> 
>>> 
>>> 
>>> 
>>> 
>>> 
>>>> -----Original Message-----
>>>> From: Jason Wong [mailto:[EMAIL PROTECTED]]
>>>> Sent: Wednesday, August 21, 2002 8:53 AM
>>>> To: [EMAIL PROTECTED]
>>>> Subject: Re: [PHP] Agh! trim (#$@#@^%!!!)
>>>> 
>>>> 
>>>> On Wednesday 21 August 2002 20:36, Mike At Spy wrote:
>>>>> Get this - it didn't work!  :(
>>>>> 
>>>>> I tried decreasing the -1 to -2 and so on, but nothing on that
>>>> either.  :(
>>>> 
>>>> Post your exact code which didn't work.
>>>> 
>>>> --
>>>> Jason Wong -> Gremlins Associates -> www.gremlins.com.hk
>>>> Open Source Software Systems Integrators
>>>> * Web Design & Hosting * Internet & Intranet Applications
>>> Development *
>>>> 
>>>> /*
>>>> You can't go home again, unless you set $HOME.
>>>> */
>>>> 
>>>> 
>>>> --
>>>> 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
>> 
> 


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

Reply via email to