php-general Digest 29 May 2011 09:49:04 -0000 Issue 7333

Topics (messages 313219 through 313223):

Re: phpsadness
        313219 by: Andre Polykanine
        313220 by: Nathan Nobbe
        313222 by: TR Shaw

Re: What's up with Quercus?
        313221 by: Nathan Nobbe

iPhone sadness
        313223 by: Richard Quadling

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 ---
Hello Nathan,

Do you mean $x{8}?
That is good but not for all situations.
I  need sometimes to make an array with letters as keys and numbers as
values,  like  this  (I  give  English alphabet just as an example, so
please don't suggest str_split):
$alphabet="abcdefghijklmnopqrstuvwxyz";
// I wish that worked
$alphabet_array=explode('', $alphabet);
$letter_numbers=array_flip($alphabet_array);

this is just one case I encountered some time ago. Yes, I made this by
separating  letters with commas... but it's not the unique case when I
need it.
-- 
With best regards from Ukraine,
Andre
Skype: Francophile
My blog: http://oire.org/menelion (mostly in Russian)
Twitter: http://twitter.com/m_elensule
Facebook: http://facebook.com/menelion

------------ Original message ------------
From: Nathan Nobbe <[email protected]>
To: Robert Cummings
Date created: , 7:33:08 PM
Subject: [PHP] phpsadness


      On Sat, May 28, 2011 at 4:33 AM, Robert Cummings 
<[email protected]>wrote:

> On 11-05-28 05:26 AM, Andre Polykanine wrote:
>
>> Hello Lester,
>>
>> Actually,  many of the points are not important for me so far, however
>> this one really drives me mad:
>> http://phpsadness.com/?page=sad/35   (can't   explode()  by  an  empty
>> string)
>> Besides that, he says nothing about unicode issues.
>> I  love  PHP  (I  really do, it's a neat language, as for me!), but it
>> *should* be unicode by default. If you ever read my code when I try to
>> make and strtr() with a unicode string, you'll understand me because I
>> do  an iconv(), then strtr() and then an iconv() back to unicode. That
>> is not a good coding practice, is it?
>>
>
> Isn't explode() with an empty string akin to division by zero?
>

Strings are already accessible through array notation anyway, seems like ol
dude may benefit from a php-general membership as well.

-nathan


--- End Message ---
--- Begin Message ---
On Sat, May 28, 2011 at 1:34 PM, Andre Polykanine <[email protected]> wrote:

> Hello Nathan,
>
> Do you mean $x{8}?
>

yup, that or $x[8];


> That is good but not for all situations.
> I  need sometimes to make an array with letters as keys and numbers as
> values,  like  this  (I  give  English alphabet just as an example, so
> please don't suggest str_split):
> $alphabet="abcdefghijklmnopqrstuvwxyz";
>

this just looks like you're after a quick way to populate an array.


> // I wish that worked
> $alphabet_array=explode('', $alphabet);
> $letter_numbers=array_flip($alphabet_array);
>

do you remember what you needed it for?  w/ the array access notation you
can get at any letter by index or you can get any index by letter.

$alphabet="abcdefghijklmnopqrstuvwxyz";

echo $alphabet[1]; // b
echo strpos($alphabet, 'b'); // 1


> this is just one case I encountered some time ago. Yes, I made this by
> separating  letters with commas... but it's not the unique case when I
> need it.


It would be nice to hear what the use-case is for this issue.

-nathan

--- End Message ---
--- Begin Message ---
Well the argument has both sides. Division by zero on many platforms resulted 
in zero. Then came IBM360 and it generated an exception causing big time issues 
in legacy code so a OS patch was written to intercept the interrupt, jam the 
result to zero and return.

Although mathematically undefined is correct, in most programtic cases zero is 
an acceptable and in fact a preferred result.

(sorry for the top posting)

Sent from my iPad

On May 28, 2011, at 5:33 AM, Robert Cummings <[email protected]> wrote:

> On 11-05-28 05:26 AM, Andre Polykanine wrote:
>> Hello Lester,
>> 
>> Actually,  many of the points are not important for me so far, however
>> this one really drives me mad:
>> http://phpsadness.com/?page=sad/35   (can't   explode()  by  an  empty
>> string)
>> Besides that, he says nothing about unicode issues.
>> I  love  PHP  (I  really do, it's a neat language, as for me!), but it
>> *should* be unicode by default. If you ever read my code when I try to
>> make and strtr() with a unicode string, you'll understand me because I
>> do  an iconv(), then strtr() and then an iconv() back to unicode. That
>> is not a good coding practice, is it?
> 
> Isn't explode() with an empty string akin to division by zero?
> 
> Cheers,
> Rob.
> -- 
> E-Mail Disclaimer: Information contained in this message and any
> attached documents is considered confidential and legally protected.
> This message is intended solely for the addressee(s). Disclosure,
> copying, and distribution are prohibited unless authorized.
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 

--- End Message ---
--- Begin Message ---
On Fri, May 27, 2011 at 11:52 PM, Arnold Hesnod <[email protected]> wrote:

> Although I've been mostly using Java and Ruby in my professional software
> development work for the past decade or so, in the past two or three years
> I've started to do more and more PHP.  I originally started using PHP
> because I needed to set-up and customize Drupal for a project.  Although as
> a programmer I've come to feel comfortable writing PHP code, I still don't
> feel like I have a good sense of where PHP is going as a platform and what's
> it's future is.  As the Drupal site has continued to grow both in terms of
> features and usage, it's become clear that this is something that I need to
> research and educate myself about.
>
> That led me to give a closer look at Quercus, the implementation of PHP 5
> that runs on top of the JVM.  I'd already heard about it somewhere along the
> line, but it's only in the past couple of weeks that I've actually pulled it
> down, read through the documentation and some of the source and tried it
> out.  So far I'm pretty impressed and enthusiastic about it.  The
> cancellation of PHP 6 combined with the steady trickle of PHP-related bugs
> and security vulnerabilities that have become public over the past few years
> had made me very nervous about the future of the platform.  Having an
> open-source implementation of PHP that runs on the JVM, which is like the
> gold standard for server application performance and reliability, is
> reassuring.  The fact that it makes it easy and fast to use the huge library
> of Java frameworks out there in your PHP applications doesn't hurt either.
>

first off quercus is not 'the' implementation of php running on the jvm,
it's 'an' implementation.  ibm project 0 is another

http://www.projectzero.org/

and there may be more.  also, java is fast, but php applications can be made
fast as well, when it comes to serving web pages.  there are times when i
would consider implementing some domain logic in something like java for
speed, but for delivering applications on the web, php is very useful and
practical in terms of performance.


> Although I've had great results so far in my experiments with Quercus, I'm
> curious to hear about other PHP developers' experiences with it.  Even
> though it seems like a significant number of people are using it for
> production applications, I'm curious why it's adoption isn't even higher
> than it is?  Given the difficulties of writing a Virtual Machine, it seems
> like leveraging the JVM is a no brainer.  Is there some technical drawback
> that I'm unaware of or is it just a case of inertia?
>

a lot of projects are mating their favorite language w/ the jvm which does
seem like a great idea, but one of the main drawbacks is the pace of feature
additions w/ the 'real' version of the project.  when i looked into quercus
a few years ago there wasn't support for things like spl and i'm not sure
where they stand w/ 5.3 features like closures and namespaces. not only that
but on any given minor release of php where is the parallel from quercus.
 also, the professional version of resin costs money.

these are probly the main reasons why the resin community isn't blowing up.

-nathan

--- End Message ---
--- Begin Message ---
On 29 May 2011 01:36, TR Shaw <[email protected]> wrote:
> (sorry for the top posting)
>
> Sent from my iPad
>

Are you telling me that you can't scroll down the page on an iPad?

I refer back to my comment that the "Sent from my iPad/iPhone" is
inherently an apology.



-- 
Richard Quadling
Twitter : EE : Zend : PHPDoc
@RQuadling : e-e.com/M_248814.html : bit.ly/9O8vFY : bit.ly/lFnVea

--- End Message ---

Reply via email to