Re: [PHP] preg_match too greedy

2009-07-29 Thread b
On 07/29/2009 11:18 PM, Daniel Kolbo wrote: b wrote: On 07/29/2009 07:48 PM, Daniel Kolbo wrote: code works (no match) for me too on php 5.2.6 build date May 2 2008 18:01:20 with dumbdows NT. preg_match fails but for a reason other than what I think you may be expecting. It fails b/c of the f

Re: [PHP] preg_match too greedy

2009-07-29 Thread Daniel Kolbo
b wrote: > On 07/29/2009 07:48 PM, Daniel Kolbo wrote: >> >> code works (no match) for me too on php 5.2.6 build date May 2 2008 >> 18:01:20 with dumbdows NT. >> >> preg_match fails but for a reason other than what I think you may be >> expecting. It fails b/c of the first forwards slash in $url.

Re: [PHP] fileinfo returning wrong mime type for Excel files

2009-07-29 Thread Paul M Foster
On Wed, Jul 29, 2009 at 05:15:38PM -0400, Christoph Boget wrote: > Consider the following: > > $finfo = finfo_open( FILEINFO_MIME, '/usr/share/file/magic' ); > if( $finfo ) > { > $mimeType = finfo_file( $finfo, '/path/to/my/excel.xls' ); > finfo_close($

Re: [PHP] preg_match too greedy

2009-07-29 Thread b
On 07/29/2009 07:48 PM, Daniel Kolbo wrote: code works (no match) for me too on php 5.2.6 build date May 2 2008 18:01:20 with dumbdows NT. preg_match fails but for a reason other than what I think you may be expecting. It fails b/c of the first forwards slash in $url. The regex engine doesn't

Re: [PHP] preg_match too greedy

2009-07-29 Thread b
On 07/29/2009 03:03 PM, Ben Dunlap wrote: Jim Lucas wrote: I expected 'no match' but get 'match'. [8<] cut/paste your code and it works for me. Works for me as well. I get 'no match' from PHP 5.1.2, 5.2.6, and 5.2.8. What version do you have? 5.2.9 If I might suggest a couple of simplifi

Re: [PHP] preg_match too greedy

2009-07-29 Thread b
On 07/29/2009 02:07 PM, Jim Lucas wrote: b wrote: I'm trying to figure out how to test if a string matches *exactly* another string, using a regexp pattern. The manual says that ereg() is deprecated (in favour of what?) and preg_match() is giving me trouble. The problem is that I'm passing the e

Re: [PHP] preg_match too greedy

2009-07-29 Thread Daniel Kolbo
Jim Lucas wrote: > Ben Dunlap wrote: >> Jim Lucas wrote: I expected 'no match' but get 'match'. >> [8<] >>> cut/paste your code and it works for me. >> Works for me as well. I get 'no match' from PHP 5.1.2, 5.2.6, and 5.2.8. What >> version do you have? > > PHP 5.2.5 with Suhosin-Patch 0.9.6.

[PHP] Re: preg_match too greedy

2009-07-29 Thread Clancy
On Wed, 29 Jul 2009 13:42:23 -0400, p...@logi.ca (b) wrote: >I'm trying to figure out how to test if a string matches *exactly* >another string, using a regexp pattern. If this is REALLY what you want to do, what is wrong with strcmp? -- PHP General Mailing List (http://www.php.net/) To unsu

Re: [PHP] Expand Variables in String

2009-07-29 Thread Jonathan Tapicer
On Wed, Jul 29, 2009 at 6:47 PM, Daniel Kolbo wrote: > Jonathan Tapicer wrote: >> Use eval, like this: >> >> eval('$str_expanded = "' . str_replace('"', '\\"', $str) . '";'); >> >> The str_replace is used because you could have a " inside $str and it >> would break the string, if you are sure the $

Re: [PHP] Expand Variables in String

2009-07-29 Thread Daniel Kolbo
Jonathan Tapicer wrote: > Use eval, like this: > > eval('$str_expanded = "' . str_replace('"', '\\"', $str) . '";'); > > The str_replace is used because you could have a " inside $str and it > would break the string, if you are sure the $str has no " inside you > can omit it. > > Jonathan > > O

Re: [PHP] Asterisk anyone?

2009-07-29 Thread Skip Evans
Per Jessen wrote: Depends on which data we're talking about. Asterisk is very flexible. For example, the first screen they want people to be able to change data on is: call waiting,do not disturb and then it looks like numbers (forwarding?) unconditional,unavailable,busy I'm trying to fig

[PHP] Re: Page or URL function?

2009-07-29 Thread Ben Dunlap
Ben Dunlap wrote [TWICE]: > The $_SERVER global array has this sort of information. The 'PHP_SELF' key [8<] > Ben Very sorry for the double-post. Reply-all in Thunderbird News seems a little overzealous by default. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://w

[PHP] Re: Page or URL function?

2009-07-29 Thread Ben Dunlap
> I've been searching php.net for a function to do this: > >if page_url('browse.php') { The $_SERVER global array has this sort of information. The 'PHP_SELF' key might be what you want: http://us.php.net/manual/en/reserved.variables.server.php But where is the code that needs to know? I'm

[PHP] fileinfo returning wrong mime type for Excel files

2009-07-29 Thread Christoph Boget
Consider the following: $finfo = finfo_open( FILEINFO_MIME, '/usr/share/file/magic' ); if( $finfo ) { $mimeType = finfo_file( $finfo, '/path/to/my/excel.xls' ); finfo_close($finfo); } echo $mimeType; When I run the above, it echoes out "

Re: [PHP] Expand Variables in String

2009-07-29 Thread Jonathan Tapicer
Use eval, like this: eval('$str_expanded = "' . str_replace('"', '\\"', $str) . '";'); The str_replace is used because you could have a " inside $str and it would break the string, if you are sure the $str has no " inside you can omit it. Jonathan On Wed, Jul 29, 2009 at 5:43 PM, Daniel Kolbo w

[PHP] Page or URL function?

2009-07-29 Thread Miller, Terion
I've been searching php.net for a function to do this: if page_url('browse.php') { $default = "A"; } $letter = isset($_GET['letter'])? $_GET['letter'] :"$default" ; else { $letter = isset($_GET['letter'])? $_GET

Re: [PHP] Ridiculous ..won't print or echo ...(RESOLVED)

2009-07-29 Thread Miller, Terion
Yep I forgot about escaping the $ On 7/29/09 10:51 AM, "Ford, Mike" wrote: > -Original Message- > From: Miller, Terion [mailto:tmil...@springfi.gannett.com] > Sent: 29 July 2009 16:36 > > Ok in my output to Quark I need to have $P printed to the page like > this: > > <@$p>2118 S. Camp

[PHP] Expand Variables in String

2009-07-29 Thread Daniel Kolbo
Hello, Is it possible to force a string to expand variable names after the string has been set and before the variable's been defined without having to do a string replace or preg_replace? for example, "; $var = "Variable Contents"; echo $str.""; $str_expanded = $str;//would like this to expand $

Re: [PHP] Getting rid of extra lines (RESOLVED)

2009-07-29 Thread Miller, Terion
On 7/29/09 3:16 PM, "Jim Lucas" wrote: Miller, Terion wrote: > > > On 7/29/09 3:05 PM, "Jonathan Tapicer" wrote: > > On Wed, Jul 29, 2009 at 4:20 PM, Miller, > Terion wrote: >> >> >> On 7/29/09 1:45 PM, "Ashley Sheridan" wrote: >> >> [snip/] >> >> Have you thought of just using a regular str

[PHP] Locating Bad Image Files

2009-07-29 Thread Floyd Resler
I use convert to create thumbnail images. However, we have several PDFs that convert doesn't seem to like. Even though it produced error messages it still creates the thumbnail which doesn't display an image. Is there an easy way for me to identify those bad image files somehow in PHP by

Re: [PHP] Getting rid of extra lines (RESOLVED)

2009-07-29 Thread Jim Lucas
Miller, Terion wrote: > > > On 7/29/09 3:05 PM, "Jonathan Tapicer" wrote: > > On Wed, Jul 29, 2009 at 4:20 PM, Miller, > Terion wrote: >> >> >> On 7/29/09 1:45 PM, "Ashley Sheridan" wrote: >> >> [snip/] >> >> Have you thought of just using a regular str_replace() on your code? You >> can ask i

Re: [PHP] Getting rid of extra lines (RESOLVED)

2009-07-29 Thread Miller, Terion
On 7/29/09 3:05 PM, "Jonathan Tapicer" wrote: On Wed, Jul 29, 2009 at 4:20 PM, Miller, Terion wrote: > > > > On 7/29/09 1:45 PM, "Ashley Sheridan" wrote: > > [snip/] > > Have you thought of just using a regular str_replace() on your code? You > can ask it to replace newlines and carriage retu

Re: [PHP] Getting rid of extra lines

2009-07-29 Thread Jonathan Tapicer
On Wed, Jul 29, 2009 at 4:20 PM, Miller, Terion wrote: > > > > On 7/29/09 1:45 PM, "Ashley Sheridan" wrote: > > [snip/] > > Have you thought of just using a regular str_replace() on your code? You > can ask it to replace newlines and carriage returns with nothing and see > if that fixes you proble

Re: [PHP] Asterisk anyone?

2009-07-29 Thread Per Jessen
Skip Evans wrote: > Hey, > > I've been asked to write a simple couple of public pages that > would let an Asterisk customer modify their account > configuration, but the client has no idea how Asterisk stores > its data, apparently not in MySQL. Depends on which data we're talking about. Asteri

Re: [PHP] Getting rid of extra lines

2009-07-29 Thread Jim Lucas
Miller, Terion wrote: > > > On 7/29/09 2:19 PM, "Jim Lucas" wrote: > > $clean = preg_replace('|\s+|', ' ', $input); > > Hi Jim, > The extra whitespace lines are in the data store, coming from it I'm going to > try your method but is there a way to not have mySQL store it with so many > lines

Re: [PHP] Getting rid of extra lines

2009-07-29 Thread Miller, Terion
On 7/29/09 2:19 PM, "Jim Lucas" wrote: $clean = preg_replace('|\s+|', ' ', $input); Hi Jim, The extra whitespace lines are in the data store, coming from it I'm going to try your method but is there a way to not have mySQL store it with so many lines (this is data being screen scraped and p

Re: [PHP] Getting rid of extra lines

2009-07-29 Thread Miller, Terion
On 7/29/09 1:45 PM, "Ashley Sheridan" wrote: [snip/] Have you thought of just using a regular str_replace() on your code? You can ask it to replace newlines and carriage returns with nothing and see if that fixes you problem? Thanks Ash www.ashleysheridan.co.uk Yep I have tried str_replac

Re: [PHP] Getting rid of extra lines

2009-07-29 Thread Jim Lucas
Miller, Terion wrote: > I am trying to get rid of empty whitespace lines, I can't us chop() because > as I read it it will remove all whitespacesright? > > Right now my db is outputting with extra lines, I have stripped tags I know > it isn't that causing it to look like this > > Blahlajdlkfj

Re: [PHP] preg_match too greedy

2009-07-29 Thread Jim Lucas
Ben Dunlap wrote: > Jim Lucas wrote: >>> I expected 'no match' but get 'match'. > [8<] >> cut/paste your code and it works for me. > > Works for me as well. I get 'no match' from PHP 5.1.2, 5.2.6, and 5.2.8. What > version do you have? PHP 5.2.5 with Suhosin-Patch 0.9.6.2 (cli) (built: Mar 11 200

[PHP] Asterisk anyone?

2009-07-29 Thread Skip Evans
Hey, I've been asked to write a simple couple of public pages that would let an Asterisk customer modify their account configuration, but the client has no idea how Asterisk stores its data, apparently not in MySQL. Anyone know of any resources for accessing Asterisk from PHP? If anyone has

Re: [PHP] preg_match too greedy

2009-07-29 Thread Ben Dunlap
Jim Lucas wrote: >> I expected 'no match' but get 'match'. [8<] > cut/paste your code and it works for me. Works for me as well. I get 'no match' from PHP 5.1.2, 5.2.6, and 5.2.8. What version do you have? If I might suggest a couple of simplifications that would make it easier to follow/troubles

RE: [PHP] Getting rid of extra lines

2009-07-29 Thread Bob McConnell
From: Miller, Terion /* snip */ Before anyone can tell you how to fix it, you need to find out what is causing that white space. is it empty lines, vertical tabs, thousands of spaces, ...? Once you find that out, it is pretty easy to decide how to get rid of them. Can you save the output to a fil

Re: [PHP] Getting rid of extra lines

2009-07-29 Thread Ashley Sheridan
[snip/] Have you thought of just using a regular str_replace() on your code? You can ask it to replace newlines and carriage returns with nothing and see if that fixes you problem? Thanks Ash www.ashleysheridan.co.uk -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http

Re: [PHP] Getting rid of extra lines

2009-07-29 Thread Miller, Terion
On 7/29/09 1:34 PM, "Ashley Sheridan" wrote: On Wed, 2009-07-29 at 11:29 -0700, Miller, Terion wrote: > I am trying to get rid of empty whitespace lines, I can't us chop() because > as I read it it will remove all whitespacesright? > > Right now my db is outputting with extra lines, I have

Re: [PHP] Getting rid of extra lines

2009-07-29 Thread Ashley Sheridan
On Wed, 2009-07-29 at 11:29 -0700, Miller, Terion wrote: > I am trying to get rid of empty whitespace lines, I can't us chop() because > as I read it it will remove all whitespacesright? > > Right now my db is outputting with extra lines, I have stripped tags I know > it isn't that causing it

[PHP] Getting rid of extra lines

2009-07-29 Thread Miller, Terion
I am trying to get rid of empty whitespace lines, I can't us chop() because as I read it it will remove all whitespacesright? Right now my db is outputting with extra lines, I have stripped tags I know it isn't that causing it to look like this Blahlajdlkfjlksdjflkdjsf <--

Re: [PHP] preg_match too greedy

2009-07-29 Thread Jim Lucas
b wrote: > I'm trying to figure out how to test if a string matches *exactly* > another string, using a regexp pattern. The manual says that ereg() is > deprecated (in favour of what?) and preg_match() is giving me trouble. > The problem is that I'm passing the end-of-line delimiter ($) but it > se

[PHP] preg_match too greedy

2009-07-29 Thread b
I'm trying to figure out how to test if a string matches *exactly* another string, using a regexp pattern. The manual says that ereg() is deprecated (in favour of what?) and preg_match() is giving me trouble. The problem is that I'm passing the end-of-line delimiter ($) but it seems to be ignor

Re: [PHP] Re: Broken IF behavior? (Changing the branch changes the evaluation)

2009-07-29 Thread Shawn McKenzie
Ford, Mike wrote: >> -Original Message- >> From: Matt Neimeyer [mailto:m...@neimeyer.org] >> Sent: 29 July 2009 16:47 >> $Ret = mysql_fetch_array($result); if(!$Ret) { } else { return >> $Ret; } >>> I'm assuming that you are calling my_fetch_array() in a loop of >> some >>> sort and so

RE: [PHP] Re: Broken IF behavior? (Changing the branch changes the evaluation)

2009-07-29 Thread Ford, Mike
> -Original Message- > From: Matt Neimeyer [mailto:m...@neimeyer.org] > Sent: 29 July 2009 16:47 > > >> $Ret = mysql_fetch_array($result); if(!$Ret) { } else { return > $Ret; } > > I'm assuming that you are calling my_fetch_array() in a loop of > some > > sort and so at some point there ar

RE: [PHP] Ridiculous ..won't print or echo ...

2009-07-29 Thread Ford, Mike
> -Original Message- > From: Miller, Terion [mailto:tmil...@springfi.gannett.com] > Sent: 29 July 2009 16:36 > > Ok in my output to Quark I need to have $P printed to the page like > this: > > <@$p>2118 S. Campbell Ave > > So in my php which is going to be grabbing this info and formatti

Re: [PHP] Re: Broken IF behavior? (Changing the branch changes the evaluation)

2009-07-29 Thread Matt Neimeyer
>> $Ret = mysql_fetch_array($result); if(!$Ret) { } else { return $Ret; } > I'm assuming that you are calling my_fetch_array() in a loop of some > sort and so at some point there are no more records in the result. Oh... Um... Yeah... Well... So... Checking the docs... "Returns an array of string

Re: [PHP] Ridiculous ..won't print or echo ...(RESOLVED)

2009-07-29 Thread Miller, Terion
Yep just figured that out too..the escaping thing.. Thanks On 7/29/09 10:45 AM, "Ashley Sheridan" wrote: On Wed, 2009-07-29 at 11:36 -0400, Miller, Terion wrote: > Ok in my output to Quark I need to have $P printed to the page like this: > > <@$p>2118 S. Campbell Ave > > So in my php which

Re: [PHP] Ridiculous ..won't print or echo ...

2009-07-29 Thread Ashley Sheridan
On Wed, 2009-07-29 at 11:36 -0400, Miller, Terion wrote: > Ok in my output to Quark I need to have $P printed to the page like this: > > <@$p>2118 S. Campbell Ave > > So in my php which is going to be grabbing this info and formatting it for > the Quarkisn't echoing that "$p" all I get is the

RE: [PHP] Ridiculous ..won't print or echo ...

2009-07-29 Thread Aipok
>Ok in my output to Quark I need to have $P printed to the page like this: > ><@$p>2118 S. Campbell Ave > >So in my php which is going to be grabbing this info and formatting it for >the Quarkisn't echoing that "$p" all I get is the <@> > >I have tried several things: > >$p = $p > >$p = print("

[PHP] Ridiculous ..won't print or echo ...

2009-07-29 Thread Miller, Terion
Ok in my output to Quark I need to have $P printed to the page like this: <@$p>2118 S. Campbell Ave So in my php which is going to be grabbing this info and formatting it for the Quarkisn't echoing that "$p" all I get is the <@> I have tried several things: $p = $p $p = print("$p") $p = e

Re: [PHP] How to Install Roadsend Compiler on Fedora

2009-07-29 Thread Jim Lucas
Javed Khan wrote: > Can something please show me to install Roadsend Compiler on Fedora 10. > Thank you, > J.K > > > Why don't you look at Roadsend for the question. http://code.roadsend.com/pcc/wiki/BuildInstructions The PHP mailing list is not a support group for Roadsend. If you

Re: [PHP] Argh Date problems (RESOLVED)

2009-07-29 Thread Miller, Terion
I had a tiny syntax error keeping it from working in the form of a cap letter. On 7/28/09 3:51 PM, "Miller, Terion" wrote: On 7/28/09 3:48 PM, "Bastien Koert" wrote: On Tue, Jul 28, 2009 at 4:02 PM, Miller, Terion wrote: > Ok so I got the > $inDate = strtotime($results[3][$i]); > > Giving

Re: [PHP] Re: Message Board Recommendations

2009-07-29 Thread Floyd Resler
On Jul 29, 2009, at 8:44 AM, Al wrote: tedd wrote: Hi gang: I have a client who is looking for a "Message Board for Subscribers" to be installed on his site -- one with a good admin. Any recommendations? Thanks, tedd If your request is for a forum type, then SMF is super http://www.s

[PHP] Re: Message Board Recommendations

2009-07-29 Thread Al
tedd wrote: Hi gang: I have a client who is looking for a "Message Board for Subscribers" to be installed on his site -- one with a good admin. Any recommendations? Thanks, tedd If your request is for a forum type, then SMF is super http://www.simplemachines.org If the need is for a co

[PHP] Re: GeoIP Character Encoding

2009-07-29 Thread Nisse Engström
On Tue, 28 Jul 2009 18:10:33 -0400, APseudoUtopia wrote: > I'm using the PECL GeoIP module on php 5.2.10. When I look up an IP > address, the geoip_record_by_name() function is giving me a string > that contains "special" characters, such as the following: The PECL GeoIP page links to

Re: [PHP] Broken IF behavior? (Changing the branch changes the evaluation)

2009-07-29 Thread Peter Ford
Matt Neimeyer wrote: > It's exactly what I would expect... The content of the row... But in > any case, what does changing the content of the { } branch have to do > with how the IF() itself is evaluated? > > array(4) { > [0]=> > string(8) "CustName" > ["config"]=> > string(8) "CustName" >

[PHP] Re: GeoIP Character Encoding

2009-07-29 Thread Nisse Engström
On Tue, 28 Jul 2009 18:10:33 -0400, APseudoUtopia wrote: > 'Portugal, 09, Vila Real De Santo António' > 'Norway, 08, Ålesund' > 'Portugal, 04, Vila Nova De Famalicão' > > (Note the ó, Å, and ã). > > I'm using PostgreSQL as my database. The database's encoding is UTF8, > and the locale is C. > >