php-general Digest 14 Feb 2009 01:41:03 -0000 Issue 5957

Topics (messages 288215 through 288245):

Re: APC problem with PHP
        288215 by: Virgilio Quilario

Re: Extract result from a https remote server response
        288216 by: Virgilio Quilario

Re: Opinions needed
        288217 by: Virgilio Quilario
        288245 by: Ashley Sheridan

Re: How can an elephant count for nothing?
        288218 by: Virgilio Quilario

Re: Simple open source CMS as a starting point
        288219 by: Virgilio Quilario
        288220 by: Shawn McKenzie

Happy 1234567890 day!
        288221 by: Lists
        288222 by: Daniel Brown
        288225 by: Luke Slater
        288226 by: TG
        288227 by: Daevid Vincent
        288228 by: Virgilio Quilario
        288233 by: Gary Maddock-Greene
        288235 by: Don Collier
        288236 by: Simon J Welsh
        288237 by: Eric Butera
        288241 by: alexus

[PHP 5.2.8] Retrieve cookies from remote host and pass them back to client.
        288223 by: Jason Cipriani
        288224 by: Andrew Ballard
        288230 by: Jason Cipriani

Execute EXE with variables
        288229 by: Dan Shirah
        288231 by: Paul M Foster
        288232 by: Dan Shirah

Help with MySQL
        288234 by: James Colannino
        288240 by: Waynn Lue
        288242 by: Shawn McKenzie

list all constitute group of array ?
        288238 by: LKSunny
        288239 by: Robert Cummings
        288243 by: Shawn McKenzie
        288244 by: Shawn McKenzie

Administrivia:

To subscribe to the digest, e-mail:
        php-general-digest-subscr...@lists.php.net

To unsubscribe from the digest, e-mail:
        php-general-digest-unsubscr...@lists.php.net

To post to the list, e-mail:
        php-gene...@lists.php.net


----------------------------------------------------------------------
--- Begin Message ---
>>
>> > Hmm, I'll try taking down the optimizer and seeing if it segfaults or
>> > not. If that's what it is it's a crying shame that apc and
>> > zend_optimizer can't get along.
>>
>>
>> maybe give eaccelerator a shot, i believe theyve got an optimizer in there.
>> im not sure how it stacks up to zend's, but it will do both caching and
>> optimization, afaik.  also, you will find a not yet stable optimization
>> extension haging out in pecl for apc,
>>
>> http://pecl.php.net/package/optimizer
>>
>> -nathan
>>
>
> I'd recommend using X-Cache. I've had nothing but good experiences with it.
>

i would also recommend x-cache.
it's incredibly fast and stable.
i could also cache data on memory with it.
have used it on high traffic sites with no problem ever since.

Virgil
http://www.jampmark.com

--- End Message ---
--- Begin Message ---
> Sorry all, I was testing in a Windows environment.
> I feel like an idiot... :)
>
> Thanks to all.
>
> --
> m a r k u s
>
> Bruno Fajardo wrote:
>>
>> Assigning the return of file_get_contents to a variable?
>> Didn't get your point...
>>
>> 2009/2/13 m a r k u s <queribus2...@hotmail.com>
>>>
>>> Shawn McKenzie wrote:
>>>>
>>>> Shawn McKenzie wrote:
>>>>>
>>>>> m a r k u s wrote:
>>>>>>
>>>>>> Hi all,
>>>>>>
>>>>>> Example :
>>>>>> https://www.moneybookers.com/app/email_check.pl?email=t...@toto.com&cust_id=123546&password=123
>>>>>> The MB server response displayed is : Illegal operation.
>>>>>> We would like to put the result below in a php variable and process it
>>>>>> .
>>>>>> An idea ?
>>>>>>
>>>>>> PS: The server is secured. The php functions like file(),
>>>>>> file_get_contents(), readfile(), fopen() has been tested.
>>>>>> Regards
>>>>>>
>>>>>> --
>>>>>>
>>>>>> m a r  k u s
>>>
>>>> allow_url_fopen = On
>>>
>>> We have no control of the MB remote server configuration.
>>>
>>> --
>>> m a r k u s
>>>
>>> --

in your php.ini, set allow_url_fopen = On

then do this:

$contents = 
file_get_contents('https://www.moneybookers.com/app/email_check.pl?email=t...@toto.com&cust_id=123546&password=123');

if ($contents !== FALSE)
  // $contents now have your data to work on

virgil
http://www.jampmark.com

--- End Message ---
--- Begin Message ---
> I'm scripting a light-weight, low volume signup registry for a running club.
> Folks sign up to volunteer for events and the like.  There will generally be
> a handful of signup registries at any one time. A typical registry will only
> contain 50 to 100 names.  Each registry is only in existence for a month or
> so.
>
> I really don't see the advantage of using a real DB [e.g., mySQL,] for this.
> Don't need any special searching, etc.
>
> Am thinking of using a simple serialized array file for each registry; or,
> using Pear Cache_lite.  Cache_lite has several nice functions I can take
> advantage of.  In spite of its name, it can be configured to be permanent.
>
> I'd just go ahead and use Cache_lite; but, I'm always reluctant to use a
> Pear package for fear it may not be updated for for future php releases,
> etc. I aways aim to keep maintenance to a minimum.
>
> Anyone had experience with Cache_Lite? Anyone have an opinion on the
> alternatives or maybe another storage approach?
>
> Thanks, Al........
>

I think you should fear for updates in Pear because that might break your code.
once you get it working and you're happy with it, try not to update
unless there is a real need.

you should also consider concurrency where multiple users
simultaneously doing logins.
your data file may end up broken.

good luck

Virgil
http://www.jampmark.com

--- End Message ---
--- Begin Message ---
On Fri, 2009-02-13 at 08:02 -0500, Al wrote:
> 
> Rene Veerman wrote:
> > Al wrote:
> >> I'm scripting a light-weight, low volume signup registry for a running 
> >> club. Folks sign up to volunteer for events and the like.  There will 
> >> generally be a handful of signup registries at any one time. A typical 
> >> registry will only contain 50 to 100 names.  Each registry is only in 
> >> existence for a month or so.
> >>
> >> I really don't see the advantage of using a real DB [e.g., mySQL,] for 
> >> this. Don't need any special searching, etc.
> >>
> >> Am thinking of using a simple serialized array file for each registry; 
> >> or, using Pear Cache_lite.  Cache_lite has several nice functions I 
> >> can take advantage of.  In spite of its name, it can be configured to 
> >> be permanent.
> >>
> >> I'd just go ahead and use Cache_lite; but, I'm always reluctant to use 
> >> a Pear package for fear it may not be updated for for future php 
> >> releases, etc. I aways aim to keep maintenance to a minimum.
> >>
> >> Anyone had experience with Cache_Lite? Anyone have an opinion on the 
> >> alternatives or maybe another storage approach?
> >>
> >> Thanks, Al........
> >>
> >>
> > AdoDB + SQL = easier to maintain than a half dozen custom storage 
> > interfaces..
> > imo.
> > 
> 
> I don't really have any custom storage interfaces. To create a new signup 
> registry, we simply place a file in the topic directory [e.g., 
> /10Krace/Volunteers.php] that contains one line of code that includes the 
> operational scripts.
> 
> require_once $_SERVER['DOCUMENT_ROOT'] . '/signups/commonReg.php';
> 
> commonReg.php takes care of everything and the signup's ID is simply 
> "/10Krace/Volunteers"
> 
> 
> 
> 
Which in itself is a custom storage interface...


Ash
www.ashleysheridan.co.uk


--- End Message ---
--- Begin Message ---
> While PHP has a lot of nice features, it also has some traps which I am 
> forever falling
> into. One which I find particularly hard to understand is how mixed mode 
> comparisons work.
> For instance
>
> $string =  'elephant';
> If($string == 0) returns true;
> If($string != 0) returns false;
> If($string === 0) returns false;
>
> I know that in this case I should use 'If($string == '')', but I still manage 
> to forget.
> Can anyone explain clearly why comparing a string with zero gives this 
> apparently
> anomalous result?
>

when comparing string with integer, the interpreter first converts
string into an integer before comparison takes place.

Virgil
http://www.jampmark.com

--- End Message ---
--- Begin Message ---
> I need simple CMS sistem that I could use as a staring point (to save some
> time in setting up the structure) in developing my own CMS. The code
> should be simple to understand so that I can easily get on and start
> building on it. It would be of great help if it already had features like
> statistics, rss feeds, and multi-language support (visitors can click on
> the flag at the top of the page and have the pages display the content in
> that particular language), but if it doesn't it's okay I would build them.
>
> For example Joomla seems to be too powerfull, and pretty diffucult to
> understand at the coding level in order to customize it to serve my
> specific needs.
>
> Does anyone know of any promising open source CMS project that I could use
> in this respect?
>
> Thanks,
> Dzenan
>

Are you referring to 5 minute sites?

anyway, try word press.
it is very easy to add custom pages in PHP.
you can also download free modules for rss feeds and multi-language
support with flags at the top.

good luck,

Virgil
http://www.jampmark.com

--- End Message ---
--- Begin Message ---
dzenan.cause...@wise-t.com wrote:
> I need simple CMS sistem that I could use as a staring point (to save some
> time in setting up the structure) in developing my own CMS. The code
> should be simple to understand so that I can easily get on and start
> building on it. It would be of great help if it already had features like
> statistics, rss feeds, and multi-language support (visitors can click on
> the flag at the top of the page and have the pages display the content in
> that particular language), but if it doesn't it's okay I would build them.
> 
> For example Joomla seems to be too powerfull, and pretty diffucult to
> understand at the coding level in order to customize it to serve my
> specific needs.
> 
> Does anyone know of any promising open source CMS project that I could use
> in this respect?
> 
> Thanks,
> Dzenan
> 
I haven't tried them, but I would suspect if you want something simple
that you can extend, you might look at some of the simple or alpha/beta
CMSs that have been developed in a PHP framework.  There are several in
the cake forge for the cakephp framework and I'm sure other frameworks
have 1 or more.

-- 
Thanks!
-Shawn
http://www.spidean.com

--- End Message ---
--- Begin Message ---
:-)
Donovan


--
  =o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o
  D. BROOKE                       EUCA Design Center
  WEB:> http://www.euca.us
  =o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o

--- End Message ---
--- Begin Message ---
2009/2/13 Lists <li...@euca.us>:
> :-)
> Donovan

    To you, as well!  I think it's really neat.  For us in the EST
time zone, with time adjustments and such, it'll be 6:31:30p tonight.

<?php echo strtotime("February 13, 2009 6:31:30 PM"); ?>

-- 
</Daniel P. Brown>
daniel.br...@parasane.net || danbr...@php.net
http://www.parasane.net/ || http://www.pilotpig.net/
Unadvertised dedicated server deals, too low to print - email me to find out!

--- End Message ---
--- Begin Message ---
On Friday 13 Feb 2009 17:39:09 Daniel Brown :
> 2009/2/13 Lists <li...@euca.us>:
> > :-)
> >
> > Donovan
>
>     To you, as well!  I think it's really neat.  For us in the EST
> time zone, with time adjustments and such, it'll be 6:31:30p tonight.
>
> <?php echo strtotime("February 13, 2009 6:31:30 PM"); ?>
>
> --
> </Daniel P. Brown>
> daniel.br...@parasane.net || danbr...@php.net
> http://www.parasane.net/ || http://www.pilotpig.net/
> Unadvertised dedicated server deals, too low to print - email me to find
> out!

Odd that I should see this on here, I wrote a script in PHP to calculate the 
time left to 1234567890 earlier...

<?php
print "Unix timestamp is: " . time() . "\n";
$left = 1234567890 - time();
print "Time left til 1234567890 is: ". $left . "\n";

But if we're being all obfuscated you could do:

<?php print "Time left: " . 1234567890 - time();

Attachment: signature.asc
Description: This is a digitally signed message part.


--- End Message ---
--- Begin Message ---
http://timestamp1234567890.com/

----- Original Message -----
From: Lists <li...@euca.us>
To: php-gene...@lists.php.net
Date: Fri, 13 Feb 2009 11:33:28 -0600
Subject: [PHP] Happy 1234567890 day!

> :-)
> Donovan
> 
> 
> -- 
>    =o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o
>    D. BROOKE                       EUCA Design Center
>    WEB:> http://www.euca.us
>    =o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 
> 

--- End Message ---
--- Begin Message ---
http://coolepochcountdown.com/

On Fri, 2009-02-13 at 13:34 -0500, TG wrote:

> http://timestamp1234567890.com/



--- End Message ---
--- Begin Message ---
> http://coolepochcountdown.com/
>
> On Fri, 2009-02-13 at 13:34 -0500, TG wrote:
>
>> http://timestamp1234567890.com/
>
>
>

Happy cool epoch 1234567890 day!

virgil
http://www.jampmark.com

--- End Message ---
--- Begin Message ---
Note quite there yet here but yes Happy 1234567890 day to you too

--
- Gary Maddock-Greene
"Luke Slater" <l...@blog-thing.com> wrote in message news:200902131812.43295.l...@blog-thing.com...
--- End Message ---
--- Begin Message ---
Lists wrote:
:-)
Donovan


Is there going to be someone contacting me about my prize? :)

--- End Message ---
--- Begin Message ---
Happy 1234567890! (yes, 3.5 minutes late)
On 14/02/2009, at 11:13 AM, Gary Maddock-Greene wrote:

Note quite there yet here but yes Happy 1234567890 day to you too

-- - Gary Maddock-Greene "Luke Slater" <l...@blog-thing.com> wrote in message news:200902131812.43295.l...@blog-thing.com ...

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


---
Simon Welsh
Admin of http://simon.geek.nz/

Who said Microsoft never created a bug-free program? The blue screen never, ever crashes!

http://www.thinkgeek.com/brain/gimme.cgi?wid=81d520e5e





--- End Message ---
--- Begin Message ---
On Fri, Feb 13, 2009 at 5:13 PM, Gary Maddock-Greene
<g...@maddock-greene.co.uk> wrote:
> Note quite there yet here but yes Happy 1234567890 day to you too
>
> --
> - Gary Maddock-Greene
> "Luke Slater" <l...@blog-thing.com> wrote in message
> news:200902131812.43295.l...@blog-thing.com...
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

woot!

-- 
http://www.voom.me | EFnet: #voom

--- End Message ---
--- Begin Message ---
wooooooooot!!!

On Fri, Feb 13, 2009 at 6:38 PM, Eric Butera <eric.but...@gmail.com> wrote:
> On Fri, Feb 13, 2009 at 5:13 PM, Gary Maddock-Greene
> <g...@maddock-greene.co.uk> wrote:
>> Note quite there yet here but yes Happy 1234567890 day to you too
>>
>> --
>> - Gary Maddock-Greene
>> "Luke Slater" <l...@blog-thing.com> wrote in message
>> news:200902131812.43295.l...@blog-thing.com...
>>
>> --
>> PHP General Mailing List (http://www.php.net/)
>> To unsubscribe, visit: http://www.php.net/unsub.php
>>
>>
>
> woot!
>
> --
> http://www.voom.me | EFnet: #voom
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>



-- 
http://alexus.org/

--- End Message ---
--- Begin Message ---
I have a PHP 5.2.8 web application that needs to retrieve a resource
from a remote URL. However, the remote host also sends a cookie back
(in a Set-Cookie header), and I need to grab that cookie and pass it
on to the client (so that it's stored by the client browser). I do
know the name of the cookie beforehand.

What is the best way to do this? Passing a cookie from PHP back to the
client is easy, it's grabbing the cookie from the remote URL that is
the problem.

There is no support for cookies in file_get_contents(), so that won't
work. I can use curl to retrieve the remote URL with headers, but curl
does not seem to provide an easy way to get the value of the cookie
beyond retrieving the HTTP headers and parsing them manually. I could
use and parse curl's cookie file (another hack) but the cookie
contains a value that is randomly generated, and the cookies in curl's
cookie jar are global to all PHP requests (so if multiple users made
the same request, their cookie value could be shared).

How can I retrieve the contents of a remote resource as well as the
value of a cookie sent with that resource?

Thanks,
Jason

P.S.: Also, as a minor side question; how, if at all, would the method
for doing this be different in PHP 4.4.9?

--- End Message ---
--- Begin Message ---
On Fri, Feb 13, 2009 at 12:42 PM, Jason Cipriani
<jason.cipri...@gmail.com>wrote:

> I have a PHP 5.2.8 web application that needs to retrieve a resource
> from a remote URL. However, the remote host also sends a cookie back
> (in a Set-Cookie header), and I need to grab that cookie and pass it
> on to the client (so that it's stored by the client browser). I do
> know the name of the cookie beforehand.
>
> What is the best way to do this? Passing a cookie from PHP back to the
> client is easy, it's grabbing the cookie from the remote URL that is
> the problem.
>
> There is no support for cookies in file_get_contents(), so that won't
> work. I can use curl to retrieve the remote URL with headers, but curl
> does not seem to provide an easy way to get the value of the cookie
> beyond retrieving the HTTP headers and parsing them manually. I could
> use and parse curl's cookie file (another hack) but the cookie
> contains a value that is randomly generated, and the cookies in curl's
> cookie jar are global to all PHP requests (so if multiple users made
> the same request, their cookie value could be shared).
>
> How can I retrieve the contents of a remote resource as well as the
> value of a cookie sent with that resource?
>
> Thanks,
> Jason
>
> P.S.: Also, as a minor side question; how, if at all, would the method
> for doing this be different in PHP 4.4.9?
>
>
I usually use the HttpRequest for this type of stuff, but it only works with
PHP 5.0/5.1 and greater. Otherwise, CURL is the next easiest, followed by
direct socket connections.

Keep in mind when passing the cookie to the client that if the client
browser is set to reject 3rd party cookies and you pass a value for $domain
to setcookie() that is different than the domain of your site, the browser
will ignore the header.

Andrew

--- End Message ---
--- Begin Message ---
On Fri, Feb 13, 2009 at 1:03 PM, Andrew Ballard <aball...@gmail.com> wrote:
> On Fri, Feb 13, 2009 at 12:42 PM, Jason Cipriani <jason.cipri...@gmail.com>
> wrote:
>>
>> I have a PHP 5.2.8 web application that needs to retrieve a resource
>> from a remote URL. However, the remote host also sends a cookie back
>> (in a Set-Cookie header), and I need to grab that cookie and pass it
>> on to the client (so that it's stored by the client browser). I do
>> know the name of the cookie beforehand.
>>
>> What is the best way to do this? Passing a cookie from PHP back to the
>> client is easy, it's grabbing the cookie from the remote URL that is
>> the problem.
>>
>> There is no support for cookies in file_get_contents(), so that won't
>> work. I can use curl to retrieve the remote URL with headers, but curl
>> does not seem to provide an easy way to get the value of the cookie
>> beyond retrieving the HTTP headers and parsing them manually. I could
>> use and parse curl's cookie file (another hack) but the cookie
>> contains a value that is randomly generated, and the cookies in curl's
>> cookie jar are global to all PHP requests (so if multiple users made
>> the same request, their cookie value could be shared).
>>
>> How can I retrieve the contents of a remote resource as well as the
>> value of a cookie sent with that resource?
>>
>> Thanks,
>> Jason
>>
>> P.S.: Also, as a minor side question; how, if at all, would the method
>> for doing this be different in PHP 4.4.9?
>>
>
> I usually use the HttpRequest for this type of stuff, but it only works with
> PHP 5.0/5.1 and greater. Otherwise, CURL is the next easiest, followed by
> direct socket connections.

Thanks! This is exactly what I was looking for. I've managed to get
everything working well with HttpRequest.

Cheers,
Jason

--- End Message ---
--- Begin Message ---
Hello all,

Can someone point me in the right direction?

I'm trying to call an EXE from PHP and pass it two variables.

I looked at the exec() command and I see that this can call the executable,
but I don't see that it can pass the variables to it.

Dan

--- End Message ---
--- Begin Message ---
On Fri, Feb 13, 2009 at 02:30:38PM -0500, Dan Shirah wrote:

> Hello all,
> 
> Can someone point me in the right direction?
> 
> I'm trying to call an EXE from PHP and pass it two variables.
> 
> I looked at the exec() command and I see that this can call the executable,
> but I don't see that it can pass the variables to it.
> 

Use the system() command, and enclose both your command and its
parameters in a pair of single quotes, as:

system('mycmd -a alfa -b bravo');

Paul
-- 
Paul M. Foster

--- End Message ---
--- Begin Message ---
>
>  Use the system() command, and enclose both your command and its
> parameters in a pair of single quotes, as:
>
> system('mycmd -a alfa -b bravo');
>
> Paul
> --
> Paul M. Foster
>

Using both exec() and system() I am getting the error: Unable to fork

--- End Message ---
--- Begin Message --- Hey everyone. I've been reading the list for a long time, but have only really posted to the mailing list a few times. I just had a quick question about MySQL. I'm not sure if this is exactly relevant to PHP, but it is for a PHP application I'm writing, so hopefully that makes this question ok :)

Basically, I was wondering if there are any queries in MySQL that I can use to determine the data types used to construct a pre-existing table. The reason I ask is that I went back to look at the data in a table I've been using for a while and realized that I forgot to document what the data types were (DOH!) I'm sure there's something, but I wasn't quite sure what to google for, so I wasn't really able to turn up anything.

Thanks!

James


--- End Message ---
--- Begin Message ---
You can type "show create table <tablename>" to see the datatypes.

Waynn

On 2/13/09, James Colannino <ja...@colannino.org> wrote:
> Hey everyone.  I've been reading the list for a long time, but have only
> really posted to the mailing list a few times.  I just had a quick
> question about MySQL.  I'm not sure if this is exactly relevant to PHP,
> but it is for a PHP application I'm writing, so hopefully that makes
> this question ok :)
>
> Basically, I was wondering if there are any queries in MySQL that I can
> use to determine the data types used to construct a pre-existing table.
> The reason I ask is that I went back to look at the data in a table I've
> been using for a while and realized that I forgot to document what the
> data types were (DOH!)  I'm sure there's something, but I wasn't quite
> sure what to google for, so I wasn't really able to turn up anything.
>
> Thanks!
>
> James
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

--- End Message ---
--- Begin Message ---
James Colannino wrote:
> Hey everyone.  I've been reading the list for a long time, but have only
> really posted to the mailing list a few times.  I just had a quick
> question about MySQL.  I'm not sure if this is exactly relevant to PHP,
> but it is for a PHP application I'm writing, so hopefully that makes
> this question ok :)
> 
> Basically, I was wondering if there are any queries in MySQL that I can
> use to determine the data types used to construct a pre-existing table. 
> The reason I ask is that I went back to look at the data in a table I've
> been using for a while and realized that I forgot to document what the
> data types were (DOH!)  I'm sure there's something, but I wasn't quite
> sure what to google for, so I wasn't really able to turn up anything.
> 
> Thanks!
> 
> James
> 
DESCRIBE tablename

-- 
Thanks!
-Shawn
http://www.spidean.com

--- End Message ---
--- Begin Message ---
<?
$a = array("a", "b", "c", "d");

/*
how to list:
abcd
abc
ab
ac
ad
bcd
bc
bd
cd
a
b
c
d

who have idea ? thank you very much !!
*/
?>



--- End Message ---
--- Begin Message ---
On Sat, 2009-02-14 at 07:41 +0800, LKSunny wrote:
> <?
> $a = array("a", "b", "c", "d");
> 
> /*
> how to list:
> abcd
> abc
> ab
> ac
> ad
> bcd
> bc
> bd
> cd
> a
> b
> c
> d
> 
> who have idea ? thank you very much !!
> */
> ?>

This looks like homework. Use recursion.

Cheers,
Rob.
-- 
http://www.interjinn.com
Application and Templating Framework for PHP


--- End Message ---
--- Begin Message ---
Robert Cummings wrote:
> On Sat, 2009-02-14 at 07:41 +0800, LKSunny wrote:
>> <?
>> $a = array("a", "b", "c", "d");
>>
>> /*
>> how to list:
>> abcd
>> abc
>> ab
>> ac
>> ad
>> bcd
>> bc
>> bd
>> cd
>> a
>> b
>> c
>> d
>>
>> who have idea ? thank you very much !!
>> */
>> ?>
> 
> This looks like homework. Use recursion.
> 
> Cheers,
> Rob.

Well, I don't know how you list them in that pattern, you need to write
an algorithm, but array_keys() will give keys for the array.

-- 
Thanks!
-Shawn
http://www.spidean.com

--- End Message ---
--- Begin Message ---
Shawn McKenzie wrote:
> Robert Cummings wrote:
>> On Sat, 2009-02-14 at 07:41 +0800, LKSunny wrote:
>>> <?
>>> $a = array("a", "b", "c", "d");
>>>
>>> /*
>>> how to list:
>>> abcd
>>> abc
>>> ab
>>> ac
>>> ad
>>> bcd
>>> bc
>>> bd
>>> cd
>>> a
>>> b
>>> c
>>> d
>>>
>>> who have idea ? thank you very much !!
>>> */
>>> ?>
>> This looks like homework. Use recursion.
>>
>> Cheers,
>> Rob.
> 
> Well, I don't know how you list them in that pattern, you need to write
> an algorithm, but array_keys() will give keys for the array.
> 
Or, if I actually read your post they are values, so maybe
array_values() or you can check http://php.net/manual/book.array.php and
hope you get an A.


-- 
Thanks!
-Shawn
http://www.spidean.com

--- End Message ---

Reply via email to