Re: [PHP] daemon without pcntl_fork

2009-08-22 Thread Jim Lucas
Lars Torben Wilson wrote: 2009/8/20 Jim Lucas : Lars Torben Wilson wrote: 2009/8/19 Per Jessen : Jim Lucas wrote: [snip] I probably wouldn't have chosen PHP for the first one, but there's no reason it shouldn't work. For the second one, did you mean to write "serial port"? That's a bit of

Re: [PHP] Is there limitation for switch case: argument's value?

2009-08-22 Thread Lars Torben Wilson
Aargh. Slipped on the trigger there--premature Send. See below for what I meant to send: 2009/8/22 Lars Torben Wilson : > 2009/8/22 Keith : >> Thanks! Torben. >> I got the point now and it works! :-) >> I'm doing this because the statements of each cases is quite long, and I >> wish to have minimu

Re: [PHP] Is there limitation for switch case: argument's value?

2009-08-22 Thread Lars Torben Wilson
2009/8/22 Keith : > Thanks! Torben. > I got the point now and it works! :-) > I'm doing this because the statements of each cases is quite long, and I > wish to have minimum coding without repetition. Hi Keith, Glad it works! I'm not sure how inverting the case statement helps you minimize the co

Re: [PHP] Is there limitation for switch case: argument's value?

2009-08-22 Thread Keith
Hahaha! Actually this is my first time coding, so I still adapting the correct way to do it. FYI, for the sake of minimizing the coding and viewing space occupied of the code, I even replace the switch block with array if the cases are just merely selecting pool of variables/categories/parameter

Re: [PHP] Is there limitation for switch case: argument's value?

2009-08-22 Thread Keith
Thanks! Adam. It works now! Actually I thought that switch block is compatible with if/elseif/else block but more efficient if the cases is >3. Because I like to have short coding without repetition, so I group the similar cases together. Thanks for your explanation! I know where is my mistake a

Re: [PHP] Is there limitation for switch case: argument's value?

2009-08-22 Thread Keith
Thanks! Torben. I got the point now and it works! :-) I'm doing this because the statements of each cases is quite long, and I wish to have minimum coding without repetition. "Lars Torben Wilson" wrote in message news:36d4833b0908202323p3c858b5fn6a1d6775aa7f8...@mail.gmail.com... 2009/8/20

Re: [PHP] Re: How do I extract link text from anchor tag as well as the URL from the "href" attribute

2009-08-22 Thread Raymond Irving
Hello, You might also want to try using the Raxan framework: require_once 'raxan/pdi/gateway.php'; $page = new RichWebPage('page.html'); echo $page['a']->text(); // this will get the text betwen the a tag   To get the image element use: $elm = $page['a img']->node(0); You can download Raxan he

Re: [PHP] Rounding down?

2009-08-22 Thread Clancy
On Sat, 22 Aug 2009 14:02:58 +0100, a...@ashleysheridan.co.uk (Ashley Sheridan) wrote: >On Sat, 2009-08-22 at 13:00 +0100, Richard Heyes wrote: >> Hi, >> >> > Is there a way to round down to the nearest 50? >> > >> > Example: Any number between 400 and 449 I would 400 to be displayed; 450 >> >

Re: [PHP] Invoking functions stored in a separate directory?

2009-08-22 Thread Clancy
On Sat, 22 Aug 2009 20:37:17 +0930, robl...@aapt.net.au (David Robley) wrote: >Clancy wrote: > >> $ok = include (HOST_PATH.'/Halla.php'); > >Because you are assigning the result of the include to a variable. Try > >include (HOST_PATH.'/Halla.php'); > >and it will work as you expect. And similarly

Re: [PHP] array() returns something weird

2009-08-22 Thread Lars Torben Wilson
2009/8/22 Szczepan Hołyszewski : >> Hm. . .it does look odd. Searching the bugs database at >> http://bugs.php.net does turn up one other report (at >> http://bugs.php.net/bug.php?id=47870 ) of array() returning NULL in >> certain hard-to-duplicate circumstances on FreeBSD, > > Yes, I found it even

Re: [PHP] array() returns something weird

2009-08-22 Thread Szczepan Hołyszewski
> Hm. . .it does look odd. Searching the bugs database at > http://bugs.php.net does turn up one other report (at > http://bugs.php.net/bug.php?id=47870 ) of array() returning NULL in > certain hard-to-duplicate circumstances on FreeBSD, Yes, I found it even before posting here, but I wasn't sure

Re: [PHP] array() returns something weird

2009-08-22 Thread Ralph Deffke
well, when I saw ur post I got immediately the thought I would bed it has to do with some stuff of $this or self. I did play arround a bit with class creation the last days and yes, with using self parent and $this I did put the HTTPPD in unstable and sometimes it died without beeing able to send

[PHP] Re: preg_replace anything that isn't WORD

2009-08-22 Thread Shawn McKenzie
Didn't seem to make it the first time. Shawn McKenzie wrote: > דניאל דנון wrote: >> Lets assume I have the string "cats i saw a cat and a dog" >> i want to strip everything except "cat" and "dog" so the result will be >> "catcatdog", >> using preg_replace. >> >> >> I've tried something like /[^(d

Re: [PHP] array() returns something weird

2009-08-22 Thread Lars Torben Wilson
2009/8/22 Szczepan Hołyszewski : >> What it looks like to me is that something is causing $foo to be a >> string before the '$foo[] = "bar";' line is encountered. What do you >> get if you put a gettype($foo); just before that line? >> >> >        $foo=null; >> >        $foo[]="bar";      // <-- $f

Re: [PHP] array() returns something weird

2009-08-22 Thread Szczepan Hołyszewski
> What it looks like to me is that something is causing $foo to be a > string before the '$foo[] = "bar";' line is encountered. What do you > get if you put a gettype($foo); just before that line? > > >$foo=null; > >$foo[]="bar"; // <-- $foo simply becomes an array NULL. That

[PHP] Re: preg_replace anything that isn't WORD

2009-08-22 Thread Shawn McKenzie
דניאל דנון wrote: > Lets assume I have the string "cats i saw a cat and a dog" > i want to strip everything except "cat" and "dog" so the result will be > "catcatdog", > using preg_replace. > > > I've tried something like /[^(dog|cat)]+/ but no success > > What should I do? > Capture everythi

Re: [PHP] array() returns something weird

2009-08-22 Thread Lars Torben Wilson
2009/8/22 Szczepan Hołyszewski : > Hello! > > I am almost certain I am hitting some kind of bug. All of a sudden, array() > stops returning an empty array and starts returning something weird. The weird > thing behaves as NULL in most circumstances (e.g. gettype() says NULL), > except: > >        $

[PHP] array() returns something weird

2009-08-22 Thread Szczepan Hołyszewski
Hello! I am almost certain I am hitting some kind of bug. All of a sudden, array() stops returning an empty array and starts returning something weird. The weird thing behaves as NULL in most circumstances (e.g. gettype() says NULL), except: $foo=array(); // <-- weird thing return

Re: [PHP] Rounding down?

2009-08-22 Thread Richard Heyes
Hi, > ... A little modification: = 50 ? '50' : '00')); } echo myRound(449) . ''; // 400 echo myRound(450) . ''; // 450 echo myRound(356) . ''; // 350 echo myRound(79) . ''; // 50 ?> PS I haven't checked if there's a PHP function for this. -- Richard Heyes HTML5 graphing:

Re: [PHP] preg_replace anything that isn't WORD

2009-08-22 Thread Jonathan Tapicer
Negating specific words with regexes isn't a good practice (see a deep discussion here: http://www.perlmonks.org/?node_id=588315), in your case I would resolve it like this: That will output: array(5) { [0]=> string(3) "cat" [1]=> string(10) "s i saw a " [2]=> string(3) "cat" [3]=

[PHP] Re: How to download and configure php mvc website locally

2009-08-22 Thread Shawn McKenzie
Sumit Sharma wrote: > Hi all, > The site I have download was developed using cake php. Now when trying to > access the website it is showing a blank page. As Sudheer suggested I went > to error log and noted down the errors there, which are as follows: > > [Thu Aug 20 14:10:16 2009] [error] [clien

[PHP] preg_replace anything that isn't WORD

2009-08-22 Thread דניאל דנון
Lets assume I have the string "cats i saw a cat and a dog" i want to strip everything except "cat" and "dog" so the result will be "catcatdog", using preg_replace. I've tried something like /[^(dog|cat)]+/ but no success What should I do? -- Use ROT26 for best security

Re: [PHP] Rounding down?

2009-08-22 Thread Richard Heyes
Hi, > It should be round() and not floor(). > > 449 / 50 = 8.98 > floor(8.98) = 8 > 8 * 50 = 400 > > round(8.98) = 9 > 9 * 50 = 450 Not based on the examples given: > Example: Any number between 400 and 449 I would 400 to be displayed -- Richard Heyes HTML5 graphing: RGraph - www.rgraph.net (u

Re: [PHP] Rounding down?

2009-08-22 Thread דניאל דנון
I also wrote a function for that, function round_to($number, $increments) { $increments = 1 / $increments; return (round($number * $increments) / $increments); } (Also published on php manual - round() ) On Sat, Aug 22, 2009 at 4:11 PM, Ron Piggott wrote: > Thanks; Amazing. Ron > > - Orig

Re: [PHP] Rounding down?

2009-08-22 Thread Ron Piggott
Thanks; Amazing. Ron - Original Message - From: "Ashley Sheridan" To: "Richard Heyes" Cc: "Ron Piggott" ; Sent: Saturday, August 22, 2009 9:02 AM Subject: Re: [PHP] Rounding down? On Sat, 2009-08-22 at 13:00 +0100, Richard Heyes wrote: Hi, > Is there a way to round down to the

Re: [PHP] Rounding down?

2009-08-22 Thread Ashley Sheridan
On Sat, 2009-08-22 at 13:00 +0100, Richard Heyes wrote: > Hi, > > > Is there a way to round down to the nearest 50? > > > > Example: Any number between 400 and 449 I would 400 to be displayed; 450 to > > 499 would be 450; 500 to 549 would be 500, etc? > > Off the top of my head: divide the numbe

Re: [PHP] Rounding down?

2009-08-22 Thread Richard Heyes
Hi, > Is there a way to round down to the nearest 50? > > Example: Any number between 400 and 449 I would 400 to be displayed; 450 to > 499 would be 450; 500 to 549 would be 500, etc? Off the top of my head: divide the number by 50, run floor() on the result, then times it by 50. 1. 449 / 50 =

Re: [PHP] Invoking functions stored in a separate directory?

2009-08-22 Thread David Robley
Clancy wrote: > $ok = include (HOST_PATH.'/Halla.php'); Because you are assigning the result of the include to a variable. Try include (HOST_PATH.'/Halla.php'); and it will work as you expect. And similarly for define ('HOST_PATH','../Engine'); Cheers -- David Robley Dynamic linking erro

[PHP] Re: Rounding down?

2009-08-22 Thread David Robley
Ron Piggott wrote: > Is there a way to round down to the nearest 50? > > Example: Any number between 400 and 449 I would 400 to be displayed; 450 > to 499 would be 450; 500 to 549 would be 500, etc? > > The original number of subscribers is from a mySQL query and changes each > day. I am trying

[PHP] Rounding down?

2009-08-22 Thread Ron Piggott
Is there a way to round down to the nearest 50? Example: Any number between 400 and 449 I would 400 to be displayed; 450 to 499 would be 450; 500 to 549 would be 500, etc? The original number of subscribers is from a mySQL query and changes each day. I am trying to present a factual statement:

Re: [PHP] daemon without pcntl_fork

2009-08-22 Thread Lars Torben Wilson
2009/8/20 Jim Lucas : > Lars Torben Wilson wrote: >> 2009/8/19 Per Jessen : >>> Jim Lucas wrote: >> >> [snip] >> >>> I probably wouldn't have chosen PHP for the first one, but there's no >>> reason it shouldn't work.  For the second one, did you mean to >>> write "serial port"?  That's a bit of a d

Re: [PHP] Invoking functions stored in a separate directory?

2009-08-22 Thread Clancy
On Fri, 21 Aug 2009 15:16:11 +0200, ak...@telkomsa.net ("Arno Kuhl") wrote: >-Original Message- >From: Clancy [mailto:clanc...@cybec.com.au] >Sent: 21 August 2009 01:26 PM >To: php-general@lists.php.net >Subject: [PHP] Invoking functions stored in a separate directory? > >I am developing