php-general Digest 23 Dec 2005 22:12:26 -0000 Issue 3867

Topics (messages 227839 through 227860):

Re: SimpleXML returning Object names with hyphens
        227839 by: Jochem Maas
        227840 by: Charlie Davis

Re: PHP is OK in IE but not in Netscape
        227841 by: Ruben Rubio Rey

Re: PHP interference in frames
        227842 by: Jochem Maas
        227844 by: Albert
        227845 by: Ron Rudman
        227846 by: Albert
        227847 by: David Hall
        227848 by: Albert

Re: Problems getting the nodeName with DomDocument
        227843 by: Rob Richards
        227858 by: Kenneth Andresen

Re: Filtering URLs problem..
        227849 by: Jochem Maas
        227850 by: Al
        227851 by: Jochem Maas
        227853 by: Al

RegEx drop everything after last pattern
        227852 by: John Nichel
        227854 by: Al
        227855 by: John Nichel

PHP Frameworks
        227856 by: Shawn McKenzie
        227857 by: Zareef Ahmed
        227859 by: Shawn McKenzie
        227860 by: Chris Shiflett

Administrivia:

To subscribe to the digest, e-mail:
        [EMAIL PROTECTED]

To unsubscribe from the digest, e-mail:
        [EMAIL PROTECTED]

To post to the list, e-mail:
        [email protected]


----------------------------------------------------------------------
--- Begin Message ---
Charlie Davis wrote:
Hey all, I've run into a snag trying to use some XML output from NOAA.

what NOAA when its at home?


The problem is that some of the fields it sends to me have a hyphen in the name. Simple XML then creates objects with hyphens in their name.

So here's the object I am having issues with:

object(SimpleXMLElement)#7 (2) {
  wind-speed => object(SimpleXMLElement)#9 (2) {
    name => string(10) Wind Speed
    value => array(37) {
      0 => string(1) 4
      1 => string(1) 4

...

      33 => string(3) 328
      34 => string(3) 338
      35 => string(3) 350
      36 => string(3) 350

you could have trimmed that down a bit.

    }
  }
}

And here's my code issues:

$xmlobj->data->parameters->direction access works fine.
$xmlobj->data->parameters->direction->value works fine. Gives me the array.


first turn up error reporting to full

error_reporting( E_ALL | E_STRICT );

$xmlobj->data->parameters->wind-speed returns an int value of 0. $xmlobj->data->parameters->wind-speed->value gives me an error:

then try something like (I'm guessing this might work, then again
the behaviour of simpleXML [especially auto/magic casting] is greek to
me):

$xmlobj->data->parameters->{'wind-speed'}
$xmlobj->data->parameters->{'wind-speed'}->value



Parse error: parse error, unexpected T_OBJECT_OPERATOR in noaa.php on line 59

So, what am I doing wrong? The only thing I can think of is the - in the wind-speed object name.

Any help would be appreciated!

-Charlie


--- End Message ---
--- Begin Message ---
Sweet. Thanks!

The {'..'} works perfectly. Never knew about that syntax.

-Charlie

Jochem Maas wrote:
Charlie Davis wrote:

Hey all, I've run into a snag trying to use some XML output from NOAA.


what NOAA when its at home?


The problem is that some of the fields it sends to me have a hyphen in the name. Simple XML then creates objects with hyphens in their name.

So here's the object I am having issues with:

object(SimpleXMLElement)#7 (2) {
  wind-speed => object(SimpleXMLElement)#9 (2) {
    name => string(10) Wind Speed
    value => array(37) {
      0 => string(1) 4
      1 => string(1) 4


...

      33 => string(3) 328
      34 => string(3) 338
      35 => string(3) 350
      36 => string(3) 350


you could have trimmed that down a bit.

    }
  }
}

And here's my code issues:

$xmlobj->data->parameters->direction access works fine.
$xmlobj->data->parameters->direction->value works fine. Gives me the array.


first turn up error reporting to full

error_reporting( E_ALL | E_STRICT );

$xmlobj->data->parameters->wind-speed returns an int value of 0. $xmlobj->data->parameters->wind-speed->value gives me an error:


then try something like (I'm guessing this might work, then again
the behaviour of simpleXML [especially auto/magic casting] is greek to
me):

$xmlobj->data->parameters->{'wind-speed'}
$xmlobj->data->parameters->{'wind-speed'}->value



Parse error: parse error, unexpected T_OBJECT_OPERATOR in noaa.php on line 59

So, what am I doing wrong? The only thing I can think of is the - in the wind-speed object name.

Any help would be appreciated!

-Charlie


--- End Message ---
--- Begin Message ---
Mike Rondeau wrote:

I am still a newbie, but I am suprised that it effects browers at all, since it 
returns
pure HTML to the browser, right? Something so simple as echoing a "hello world" shouldn't cause trouble in so popular a browser as Netscape I would think...

* Netscape is not suported anymore.
* Get firefox and make sure its working on it http://www.mozilla.com/firefox/
* You can also try it with opera http://www.opera.com/

If code is working there, your web will be 99.9% cross browser compatible.

Mike
PHP Newbie
----- Original Message ----- From: David Grant To: Nanu Kalmanovitz Cc: [email protected] Sent: Thursday, December 22, 2005 2:54 AM
 Subject: Re: [PHP] PHP is OK in IE but not in Netscape


 Nanu,

 Nanu Kalmanovitz wrote:
 > Ok, I will forget Netscape, what other popular browsers beside M$-IE
 > works with M$-Windows?

 I wouldn't "forget" Netscape, because people still use it.  Just make
 sure your code validates to W3C standards and so long as it isn't too
 cutting edge, must browsers should display it fine.

 To answer your question, Opera is probably the third most popular
 browser on Windows.

 Cheers,

 David
-- David Grant
 http://www.grant.org.uk/

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



--- End Message ---
--- Begin Message ---
PHP Superman wrote:
I'm taking a wild guess here, maybe the browser insists on waiting for some
content but it's maximum content wait time is 5 seconds, the browser could
detect the connection to the server is still open and wait for 5 seconds or
another time

to get an idea of what the browser is doing (how its waiting etc)
tail the webserver log to see how/when the requests come in - should give
you a clue as to what is happening:

either the server puts them on hold or the browser is holding back sending
the request.


On 12/22/05, Ron Rudman <[EMAIL PROTECTED]> wrote:

I've got this down to a bare bones test but am still stumped.  Can anyone
explain why I get the behavior I do?

I have a frameset with 3 frames:
<html>
<head><title>testing</title></head>
<frameset rows='100,100,*'>
   <frame src='test1.php'></frame>
   <frame src='test2.php'></frame>
   <frame src='test3.php'></frame>
</frameset>
</html>

test1.php and test2.php are both simply:    <? sleep(5); ?>
test3.php is simply:   <? echo "This is some content"; ?>

When I invoke the main frameset, the output from test3.php takes 5 seconds
to appear.
If I comment out either one of the sleep calls, the output from test3.phpis
immediate, which is what I expected in the first place.

I have session.auto_start = 0 in php.ini, so this has nothing to do with
sessions.
I am running php 5.0.5.
I get the same results with both apache 2/mod_php and lighttpd/fastcgi,
the
latter with 40 php processes running.

I thought that each frame in a page was executed independently and
asynchronously, yet frame4.php insists on "waiting" for one of the other
frames to complete  (if the sleeps are 5 and 10, frame3 produces its
output
after 5 seconds).

What am I missing here?

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





--
Hi Everyone, I am running PHP 5 on Windosws XP SP2 with MySQL5, Bye Now!


--- End Message ---
--- Begin Message ---
> On 12/22/05, Ron Rudman <[EMAIL PROTECTED]> wrote:
> 
>>I've got this down to a bare bones test but am still stumped.  Can anyone
>>explain why I get the behavior I do?
>>
>>I have a frameset with 3 frames:
>><html>
>><head><title>testing</title></head>
>><frameset rows='100,100,*'>
>>    <frame src='test1.php'></frame>
>>    <frame src='test2.php'></frame>
>>    <frame src='test3.php'></frame>
>></frameset>
>></html>
>>
>>test1.php and test2.php are both simply:    <? sleep(5); ?>
>>test3.php is simply:   <? echo "This is some content"; ?>

I tested this in both IE6 (6.0.2900.2180.xpsp.0503101-1521 to be exact) and
Mozilla Firefox 1.0.6 on Windows XP SP2 running Apache 1.33 with PHP 4.3.9
on the same machine.

In IE the content of test3.php is displayed immediately and 5 seconds later
the content of test1.php and test2.php (I've added an echo after the
sleep(5); to see what happens.

In Mozilla it takes 5 seconds to display test3.php. When I put that frame at
the top it displays immediately. If I put it in the middle it displays
immediately. 

What I do remember is that when I download multiple files (using IE or
Mozilla on WinXP) from the same server I can only do two downloads at a
time. I don't know if this is an OS setting. I did found a setting for IE
and changed that value to 5 so now I can download up to 5 files from the
same server at the same time. Don't know where to change it in Mozilla.

It therefore seems that the browser makes a connection to the server for the
first page and starts downloading it. At the same time it makes a connection
to the server for the second page and starts downloading it. After one of
these two have downloaded it start downloading the third page.

If you change the setting in the browser (like I did with IE) you can
download up to that number of pages at the same time.

It is therefore not an issue with PHP but with the browser. 

HTH

Albert 

(PS List replies only please!)

-- 
No virus found in this outgoing message.
Checked by AVG Free Edition.
Version: 7.1.371 / Virus Database: 267.14.5/212 - Release Date: 2005/12/23
 

--- End Message ---
--- Begin Message ---
I tried quite a few tests.  Each time, the frameset logged immediately, then
4-5 seconds later came the rest.  Examples:

192.168.1.1 - - [23/Dec/2005:07:09:18 -0500] "GET /vsg/test.php HTTP/1.1"
200 167
192.168.1.1 - - [23/Dec/2005:07:09:23 -0500] "GET /vsg/test1.php HTTP/1.1"
200 0
192.168.1.1 - - [23/Dec/2005:07:09:23 -0500] "GET /vsg/test3.php HTTP/1.1"
200 36
192.168.1.1 - - [23/Dec/2005:07:09:23 -0500] "GET /vsg/test2.php HTTP/1.1"
200 0

192.168.1.1 - - [23/Dec/2005:07:09:30 -0500] "GET /vsg/test.php HTTP/1.1"
200 167
192.168.1.1 - - [23/Dec/2005:07:09:34 -0500] "GET /vsg/test1.php HTTP/1.1"
200 0
192.168.1.1 - - [23/Dec/2005:07:09:35 -0500] "GET /vsg/test3.php HTTP/1.1"
200 36
192.168.1.1 - - [23/Dec/2005:07:09:35 -0500] "GET /vsg/test2.php HTTP/1.1"
200 0

The log makes it look like *all* the frames are held back.  Seems like the
request is logged when it completes, so the logging process can't show us
whether the client held back frame 3 or frame 3 was put on hold by the
server.

-----Original Message-----
From: Jochem Maas [mailto:[EMAIL PROTECTED] 
Sent: Friday, December 23, 2005 6:21 AM
To: PHP Superman
Cc: Ron Rudman; [email protected]
Subject: Re: [PHP] PHP interference in frames

PHP Superman wrote:
> I'm taking a wild guess here, maybe the browser insists on waiting for 
> some content but it's maximum content wait time is 5 seconds, the 
> browser could detect the connection to the server is still open and 
> wait for 5 seconds or another time

to get an idea of what the browser is doing (how its waiting etc) tail the
webserver log to see how/when the requests come in - should give you a clue
as to what is happening:

either the server puts them on hold or the browser is holding back sending
the request.

> 
> On 12/22/05, Ron Rudman <[EMAIL PROTECTED]> wrote:
> 
>>I've got this down to a bare bones test but am still stumped.  Can 
>>anyone explain why I get the behavior I do?
>>
>>I have a frameset with 3 frames:
>><html>
>><head><title>testing</title></head>
>><frameset rows='100,100,*'>
>>    <frame src='test1.php'></frame>
>>    <frame src='test2.php'></frame>
>>    <frame src='test3.php'></frame>
>></frameset>
>></html>
>>
>>test1.php and test2.php are both simply:    <? sleep(5); ?>
>>test3.php is simply:   <? echo "This is some content"; ?>
>>
>>When I invoke the main frameset, the output from test3.php takes 5 
>>seconds to appear.
>>If I comment out either one of the sleep calls, the output from 
>>test3.phpis immediate, which is what I expected in the first place.
>>
>>I have session.auto_start = 0 in php.ini, so this has nothing to do 
>>with sessions.
>>I am running php 5.0.5.
>>I get the same results with both apache 2/mod_php and 
>>lighttpd/fastcgi, the latter with 40 php processes running.
>>
>>I thought that each frame in a page was executed independently and 
>>asynchronously, yet frame4.php insists on "waiting" for one of the 
>>other frames to complete  (if the sleeps are 5 and 10, frame3 produces 
>>its output after 5 seconds).
>>
>>What am I missing here?
>>
>>--
>>PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: 
>>http://www.php.net/unsub.php
>>
>>
> 
> 
> 
> --
> Hi Everyone, I am running PHP 5 on Windosws XP SP2 with MySQL5, Bye Now!
> 

--- End Message ---
--- Begin Message ---
Ron Rudman wrote:
> The log makes it look like *all* the frames are held back.  Seems like the
> request is logged when it completes, so the logging process can't show us
> whether the client held back frame 3 or frame 3 was put on hold by the
> server.

I checked my logs and it seems the same. But when I move test3.php to the
top or middle then it is loaded immediately after the frameset.

Using Mozilla:
Test3.php as the last frame:
127.0.0.1 - - [23/Dec/2005:14:23:40 +0200] "GET /test/ HTTP/1.1" 200 219
127.0.0.1 - - [23/Dec/2005:14:23:45 +0200] "GET /test/page1.php HTTP/1.1"
200 19
127.0.0.1 - - [23/Dec/2005:14:23:45 +0200] "GET /test/page3.php HTTP/1.1"
200 32
127.0.0.1 - - [23/Dec/2005:14:23:45 +0200] "GET /test/page2.php HTTP/1.1"
200 19

Test3.php as the middle frame:
127.0.0.1 - - [23/Dec/2005:14:24:47 +0200] "GET /test/ HTTP/1.1" 200 219
127.0.0.1 - - [23/Dec/2005:14:24:47 +0200] "GET /test/page3.php HTTP/1.1"
200 32
127.0.0.1 - - [23/Dec/2005:14:24:52 +0200] "GET /test/page1.php HTTP/1.1"
200 19
127.0.0.1 - - [23/Dec/2005:14:24:52 +0200] "GET /test/page2.php HTTP/1.1"
200 19

Test3.php as the top frame:
127.0.0.1 - - [23/Dec/2005:14:25:43 +0200] "GET /test/ HTTP/1.1" 200 219
127.0.0.1 - - [23/Dec/2005:14:25:43 +0200] "GET /test/page3.php HTTP/1.1"
200 32
127.0.0.1 - - [23/Dec/2005:14:25:48 +0200] "GET /test/page2.php HTTP/1.1"
200 19
127.0.0.1 - - [23/Dec/2005:14:25:48 +0200] "GET /test/page1.php HTTP/1.1"
200 19

This is either a Browser or an OS issue. Not a PHP/Apache issue.

Albert

-- 
No virus found in this outgoing message.
Checked by AVG Free Edition.
Version: 7.1.371 / Virus Database: 267.14.5/212 - Release Date: 2005/12/23
 

--- End Message ---
--- Begin Message ---
Albert wrote:

same server at the same time. Don't know where to change it in Mozilla.



type about:config in browser window
network.http.max-persistent-connections-per-server in the line
the default value is 2, so I think that's our answer

David Hall

--- End Message ---
--- Begin Message ---
David Hall wrote:
> Albert wrote:
>
> > same server at the same time. Don't know where to change it in Mozilla.
> > 
> > 
>
> type about:config in browser window
> network.http.max-persistent-connections-per-server in the line
> the default value is 2, so I think that's our answer

Yes it resolved the issue.

-- 
No virus found in this outgoing message.
Checked by AVG Free Edition.
Version: 7.1.371 / Virus Database: 267.14.5/212 - Release Date: 2005/12/23
 

--- End Message ---
--- Begin Message ---
Kenneth Andresen wrote:
I am having problems with the following functions where my return simply is "#text Joe #text Smith #text unknown", it should have read
firstname Joe lastname Smith address unknown

What am I doing wrong?

You're trying to access the name of the Text node which is always #text and not it's parent element.
$name = $elem->parentNode->nodeName;

Rob

--- End Message ---
--- Begin Message ---
Thanks Rob, that solved the problem for me!

Rob Richards wrote:

Kenneth Andresen wrote:

I am having problems with the following functions where my return simply is "#text Joe #text Smith #text unknown", it should have read
firstname Joe lastname Smith address unknown

What am I doing wrong?


You're trying to access the name of the Text node which is always #text and not it's parent element.
$name = $elem->parentNode->nodeName;

Rob



--- End Message ---
--- Begin Message ---
Al wrote:
I didn't fully test this; but it should get you started.

fully? more like not at all.

point 1:

"%<a\040href\040*=['"]$types://((www.)*[\w/\.]+)['"]>.+</a>%i";
                    ^-- double quotes are not escaped == parse error

point 2:

"%<a\040href\040*=['"]$types://((www.)*[\w/\.]+)['"]>.+</a>%i";
                      ^-- this will inject the string 'Array' into the regexp 
string


point 3:

the regexp does not take into account that HTML tag attributes can
occur in any order e.g:

<a class="mine" id="abc123" target="_top" href="www.bla.com"    >
testing
</a>
                

point 4:

what happens when the url does not have a protocol specified?
granted the OP did not actually specify if strings like:

        "www.google.com"

should also be considered as a url, so this is not really a valid point.


$types= array('http', 'ftp', 'https', 'mms', 'irc');

$pattern= "%<a\040href\040*=['"]$types://((www.)*[\w/\.]+)['"]>.+</a>%i"; // the "i" makes it non case sensitive

if(preg_match($pattern, $URL_str, $match)){

    $URL= match[1];
}

else{

    User did not enter a complete link; do the simple thing
}



Anders Norrbring wrote:


I'm writing a filter/parsing function for texts entered by users, and I've run into a problem... What I'm trying to do is to parse URLs of different sorts, ftp, http, mms, irc etc and format them as links, that part was real easy..

The hard part is when a user has already entered a complete link..
In short:

http://www.server.tld/page.html
should be converted to:
<a href='http://www.server.tld/page.html'>http://www.server.tld/page.html</a>

That part works fine, but if the user enters:

<a href='http://www.server.tld/page.html'>click here</a>

it all becomes a mess...  Can somebody please make a suggestion on this?



--- End Message ---
--- Begin Message ---
Jochem Maas wrote:
Al wrote:

I didn't fully test this; but it should get you started.


fully? more like not at all.

point 1:

"%<a\040href\040*=['"]$types://((www.)*[\w/\.]+)['"]>.+</a>%i";
            ^-- double quotes are not escaped == parse error

point 2:

"%<a\040href\040*=['"]$types://((www.)*[\w/\.]+)['"]>.+</a>%i";
^-- this will inject the string 'Array' into the regexp string


point 3:

the regexp does not take into account that HTML tag attributes can
occur in any order e.g:

<a class="mine" id="abc123" target="_top" href="www.bla.com"    >
testing
</a>
point 4:

what happens when the url does not have a protocol specified?
granted the OP did not actually specify if strings like:

    "www.google.com"

should also be considered as a url, so this is not really a valid point.


$types= array('http', 'ftp', 'https', 'mms', 'irc');

$pattern= "%<a\040href\040*=['"]$types://((www.)*[\w/\.]+)['"]>.+</a>%i"; // the "i" makes it non case sensitive

if(preg_match($pattern, $URL_str, $match)){

    $URL= match[1];
}

else{

    User did not enter a complete link; do the simple thing
}



Anders Norrbring wrote:


I'm writing a filter/parsing function for texts entered by users, and I've run into a problem... What I'm trying to do is to parse URLs of different sorts, ftp, http, mms, irc etc and format them as links, that part was real easy..

The hard part is when a user has already entered a complete link..
In short:

http://www.server.tld/page.html
should be converted to:
<a href='http://www.server.tld/page.html'>http://www.server.tld/page.html</a>

That part works fine, but if the user enters:

<a href='http://www.server.tld/page.html'>click here</a>

it all becomes a mess...  Can somebody please make a suggestion on this?



Jochem's correct. I was in too big a hurry trying to help. It was obvious that Anders was not getting much useful help. His points 3 and 4 are valid and I was not addressing them because they require more work than I have time to devote.

Here is corrected code. It works with the "Regex Coach". I did not try it with 
a php script.

$types= (http|ftp|https|mms|irc);

$pattern= "%<a\040href\040*=['\"]$types://((www.)*[\w/\.]+)['\"]>.+</a>%i";  // the 
"i" makes it non case sensitive

if(preg_match($pattern, $URL_str, $match)){

    $URL= match[2];
}

else{

    User did not enter a complete link; do the simple thing
}

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

...


Jochem's correct. I was in too big a hurry trying to help. It was

you don't mind if I forward that to my girlfriend? ;-) (the bit about me being 
correct)

obvious that Anders was not getting much useful help. His points 3 and 4

the lack of help is due to the fact that the problem is much easier to
explain/understand than to solve properly, and starting out with regular
expressions is a steep learning curve. that said I think the OP has plenty
of stuff to put his teeth into.

are valid and I was not addressing them because they require more work than I have time to devote.

fair enough :-)


Here is corrected code. It works with the "Regex Coach". I did not try it with a php script.

$types= (http|ftp|https|mms|irc);

I think there are a couple of single quotes missing in tyhe line above,
and the parentheses are probably meant to be square brackets:

$types= '[http|ftp|https|mms|irc]';


$pattern= "%<a\040href\040*=['\"]$types://((www.)*[\w/\.]+)['\"]>.+</a>%i"; // the "i" makes it non case sensitive

if(preg_match($pattern, $URL_str, $match)){

    $URL= match[2];
}

else{

    User did not enter a complete link; do the simple thing
}


--- End Message ---
--- Begin Message ---
Jochem Maas wrote:

...


Jochem's correct. I was in too big a hurry trying to help. It was


you don't mind if I forward that to my girlfriend? ;-) (the bit about me being correct)

obvious that Anders was not getting much useful help. His points 3 and 4


the lack of help is due to the fact that the problem is much easier to
explain/understand than to solve properly, and starting out with regular
expressions is a steep learning curve. that said I think the OP has plenty
of stuff to put his teeth into.

are valid and I was not addressing them because they require more work than I have time to devote.


fair enough :-)


Here is corrected code. It works with the "Regex Coach". I did not try it with a php script.

$types= (http|ftp|https|mms|irc);


I think there are a couple of single quotes missing in tyhe line above,
and the parentheses are probably meant to be square brackets:

$types= '[http|ftp|https|mms|irc]';


$pattern= "%<a\040href\040*=['\"]$types://((www.)*[\w/\.]+)['\"]>.+</a>%i"; // the "i" makes it non case sensitive

if(preg_match($pattern, $URL_str, $match)){

    $URL= match[2];
}

else{

    User did not enter a complete link; do the simple thing
}

..
 think there are a couple of single quotes missing in tyhe line above,

['\"] says either single or double quote.

and the parentheses are probably meant to be square brackets:

$types= '[http|ftp|https|mms|irc]'; Says: every "h" every "t" every "p" every 
"|"..... etc.

He needs (http|ftp|https|mms|irc); Which says "http" or "ftp" or https .... etc.

Note, I'm using $match[2], not $match[1].

--- End Message ---
--- Begin Message --- Okay, maybe it's just the fact that I'm concentration on getting out of here for the holidays more than I am on my work, but I'm pulling my hair out. Say I have a string -

Now, is the time; for all good men! to come to the aide? of their

What I want to do is drop everything after (and including) the last punctuation mark (? in this case). I've got my pattern to match any punctuation mark, but I just can't get the last one (it always hits on the first). I'd love to use the string functions, but it has to be a regular expression (right now it's punctuation, but eventually it's going to need to be just about anything; last new line, last white space, last 'b', etc).

--
John C. Nichel IV
Programmer/System Admin (ÜberGeek)
Dot Com Holdings of Buffalo
716.856.9675
[EMAIL PROTECTED]       

--- End Message ---
--- Begin Message ---
John Nichel wrote:
Okay, maybe it's just the fact that I'm concentration on getting out of here for the holidays more than I am on my work, but I'm pulling my hair out. Say I have a string -

Now, is the time; for all good men! to come to the aide? of their

What I want to do is drop everything after (and including) the last punctuation mark (? in this case). I've got my pattern to match any punctuation mark, but I just can't get the last one (it always hits on the first). I'd love to use the string functions, but it has to be a regular expression (right now it's punctuation, but eventually it's going to need to be just about anything; last new line, last white space, last 'b', etc).


Consider using preg_split() and then array_pop()

--- End Message ---
--- Begin Message ---
John Nichel wrote:
Okay, maybe it's just the fact that I'm concentration on getting out of here for the holidays more than I am on my work, but I'm pulling my hair out. Say I have a string -

Now, is the time; for all good men! to come to the aide? of their

What I want to do is drop everything after (and including) the last punctuation mark (? in this case). I've got my pattern to match any punctuation mark, but I just can't get the last one (it always hits on the first). I'd love to use the string functions, but it has to be a regular expression (right now it's punctuation, but eventually it's going to need to be just about anything; last new line, last white space, last 'b', etc).

Arrrrrrggggggghhhhhhh...okay, solved. Days like this, the easy stuff is nearly impossible.

/[\.,?!;:][\w\s]+$/e

--
John C. Nichel IV
Programmer/System Admin (ÜberGeek)
Dot Com Holdings of Buffalo
716.856.9675
[EMAIL PROTECTED]

--- End Message ---
--- Begin Message ---
Is there a good recent article on PHP Frameworks, or do people here has
a predominant one that outshines the others?

I'm looking for something that is easy to use, fast and stable.

Thanks!
-Shawn

--- End Message ---
--- Begin Message ---
Hi,
        There are a lot of  PHP frameworks like Mojavi, Phrame, php.MVC,
phpwebtk, Horde.

My choice is Mojavi.

BTW Zend is also doing some great work on it.

Zareef Ahmed



----- Original Message ----- 
From: "Shawn McKenzie" <[EMAIL PROTECTED]>
To: <[email protected]>
Sent: Friday, December 23, 2005 2:57 PM
Subject: [PHP] PHP Frameworks


> Is there a good recent article on PHP Frameworks, or do people here has
> a predominant one that outshines the others?
>
> I'm looking for something that is easy to use, fast and stable.
>
> Thanks!
> -Shawn
>
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

====================================================
PHP Expert Consultancy in Development  http://www.indiaphp.com
Yahoo! : consultant_php MSN : [EMAIL PROTECTED]


>

--- End Message ---
--- Begin Message ---
Thanks.  I searched on "Zend PHP Framework" because I had seen it
referenced somewhere, however I can just find plans and objectives and
no usable "framework".

Thanks!
-Shawn

Zareef Ahmed wrote:
> Hi,
>         There are a lot of  PHP frameworks like Mojavi, Phrame, php.MVC,
> phpwebtk, Horde.
> 
> My choice is Mojavi.
> 
> BTW Zend is also doing some great work on it.
> 
> Zareef Ahmed
> 
> 
> 
> ----- Original Message ----- 
> From: "Shawn McKenzie" <[EMAIL PROTECTED]>
> To: <[email protected]>
> Sent: Friday, December 23, 2005 2:57 PM
> Subject: [PHP] PHP Frameworks
> 
> 
> 
>>Is there a good recent article on PHP Frameworks, or do people here has
>>a predominant one that outshines the others?
>>
>>I'm looking for something that is easy to use, fast and stable.
>>
>>Thanks!
>>-Shawn
>>
>>-- 
>>PHP General Mailing List (http://www.php.net/)
>>To unsubscribe, visit: http://www.php.net/unsub.php
>>
>>
> 
> 
> ====================================================
> PHP Expert Consultancy in Development  http://www.indiaphp.com
> Yahoo! : consultant_php MSN : [EMAIL PROTECTED]
> 
> 
> 

--- End Message ---
--- Begin Message ---
Shawn McKenzie wrote:
I searched on "Zend PHP Framework" because I had seen it
referenced somewhere, however I can just find plans and
objectives and no usable "framework".

It hasn't been released yet. However, there are many components that are finished, and I think Zend hopes to release a beta soon.

There was a recent webcast that was pretty informative. I summarize it here:

http://shiflett.org/archive/171

You can also watch the recording:

http://www.phparch.com/webcasts/recordings/dec0205_zend.php

If you want a framework that you can use now, the Zend Framework is not for you. In a few months, it might be something to consider.

Hope that helps.

Chris

--
Chris Shiflett
Brain Bulb, The PHP Consultancy
http://brainbulb.com/

--- End Message ---

Reply via email to