Re: Bug #16681 Updated: Request new words(), word(), wordindex(), wordlength() functions]
| From: | Tomas V.V.Cox | Date: | Fri, 19 Apr 2002 10:54:29 +0000 |
| Subject: | Re: Bug #16681 Updated: Request new words(), word(), wordindex(), wordlength() functions] | ||
| References: | 1 2 3 | Groups: | php.pear.dev php.pear.general |
| Request: | Send a blank email to pear-general+get-1209@lists.php.net to get a copy of this message | ||
Daniel Lorch wrote:
>
> Hi,
>
> In case you didn't follow PHP-Dev, here's the request from an user:
>
> I know it's terribly easy to do (1-2 liners), but I'd like to
> contribute to PEAR and learn about the coding-rules.
>
> there are just some questions left:
> - am I allowed to use ternary operators "?" and ":" ?
Sure
> - am I allowed to jump out of a switch without using break? Example:
>
> function foo($bar) {
> switch($bar) {
> case 'moo':
> return 'cow';
> case 'woof':
> return 'dog';
> }
> return false;
> }
Sure
> - Is PEAR about creating stuff people should learn from? I mean
> perfect, "educational" code or am I allowed to to used advanced
> techniques? I'm making excessive use of regular expressions.
I'll vote for good and eficient code than educational. Or do you in
php-dev make educational extensions? ;-)
For the rest, sorry the CS can't be discussed until the next week, we
have overpass the number of possible CS discussions this week.
BTW If you finally add a String class I would like to contribute with a
"human friendly implode" function:
$opts = array("Yes", "No", "Perhaps", "Sure");
print String::humanImplode(',', 'or', $opts);
Output: "Yes, No, Perhaps or Sure"
Tomas V.V.Cox
> - why should I write curly braces like this:
>
> function foo()
> {
>
> }
>
> instead of
>
> function foo() {
>
> }
>
> Blocks start with a keyword, such as for, while, function and end
> with a "}". I find this perfectly esthetical.
>
> - why do function names use "bumpy case" instead of C-like or even
> PHP-like "underscored" function names?
>
> -daniel
>
> ----- Original Message -----
> From : Daniel Lorch [mailto:daniel@lorch.cc]
> Sent : Freitag, 19. April 2002
> Subject: [PEAR] Re[2]: [PHP-DEV] [phpbugs@priorwebsites.com: Bug #16681 Updated: Request new
> words(), word(), wordindex(), wordlength() functions]
>
> > Hi,
>
> > Great idea. I could take care of this - how do I "assign" it to me?
> > Just start writing code?
>
> > -daniel
>
> > ----- Original Message -----
> > From : derick@php.net [mailto:derick@php.net]
> > Sent : Freitag, 19. April 2002
> > Subject: [PHP-DEV] [phpbugs@priorwebsites.com: Bug #16681 Updated: Request new words(),
> > word(), wordindex(), wordlength() functions]
>
> >> Hey,
>
> >> why not make a PEAR thingy for this?
>
> >> Derick
>
> >> On Fri, 19 Apr 2002, Daniel Lorch wrote:
>
> >>> hi,
> >>>
> >>> > Well, I like the idea(s).
> >>>
> >>> > I think returning (bool)false instead of NULL is more
> >>> > consistent though.
> >>>
> >>> > Maybe the naming convention should be changed to:
> >>>
> >>> ..while paying attention to english orthography:
> >>>
> >>> > word()
> >>> > word_count()
> >>> > word_index()
> >>> > word_lenght()
> >>>
> >>> word_length()
> >>>
> >>> common pitfall - maybe we should provide an alias? :)
> >>>
> >>> > - Markus
> >>>
> >>> word_* functions can be easily solved in userland, but nevertheless,
> >>> after thinking about it, it might be a good addition. At least it does
> >>> not hurt anyone, does it? :)
> >>>
> >>> -daniel
> >>>
> >>>
> >>>
> >>> --
> >>> PHP Development Mailing List <http://www.php.net/·×Ïk±:üy¿ì
> >>>
> >>> To unsubscribe, visit:
> >>> http://www.php.net/unsub.php
> >>>