OSEC

Neohapsis is currently accepting applications for employment. For more information, please visit our website www.neohapsis.com or email hr@neohapsis.com
php-general Digest 29 Feb 2008 12:03:38 -0000 Issue 5321

php-general-digest-helplists.php.net
Date: Fri Feb 29 2008 - 06:03:38 CST


php-general Digest 29 Feb 2008 12:03:38 -0000 Issue 5321

Topics (messages 270667 through 270728):

Re: echo returnArray()['a']; // workaround
        270667 by: Nathan Nobbe
        270668 by: Nathan Nobbe
        270669 by: Nathan Rixham
        270689 by: Robert Cummings
        270692 by: Nathan Rixham
        270693 by: Nathan Rixham
        270698 by: Robert Cummings
        270700 by: Robert Cummings
        270701 by: Nathan Rixham
        270702 by: Robert Cummings
        270703 by: Casey
        270706 by: Robert Cummings
        270709 by: Casey
        270710 by: Nathan Rixham
        270712 by: Robert Cummings
        270713 by: Nathan Nobbe

Re: Choose Your Common Design Patterns
        270670 by: Shelley
        270715 by: Zoltán Németh

Sessions
        270671 by: VamVan
        270672 by: Ray Hauge
        270673 by: Warren Vail

imagettftext and utf-8 (swedish characters)
        270674 by: David Sveningsson
        270675 by: Nathan Rixham
        270676 by: David Sveningsson
        270677 by: Nathan Rixham
        270679 by: David Sveningsson

handling dates before 1901
        270678 by: Gabriel Kuri
        270680 by: Nathan Rixham
        270682 by: Gabriel Kuri
        270711 by: Larry Garfield

Making sure an include file works
        270681 by: Richard S. Crawford
        270684 by: Dan Joseph
        270687 by: Robert Cummings
        270695 by: Casey
        270697 by: Robert Cummings
        270704 by: Jim Lucas
        270705 by: Robert Cummings
        270707 by: Jim Lucas
        270708 by: Robert Cummings

dont print echo
        270683 by: Emiliano Boragina
        270685 by: chetan rane
        270699 by: Mr Webber

Re: Sometimes I wonder why I even started programming...
        270686 by: Robert Cummings
        270717 by: Zoltán Németh
        270718 by: Zoltán Németh
        270720 by: Colin Guthrie
        270723 by: Colin Guthrie
        270724 by: Zoltán Németh

Re: output buffering in CLI script.
        270688 by: Casey
        270690 by: Jim Lucas

Text Color
        270691 by: Jeff
        270694 by: Jim Lucas

Re: reverse string without strrev();
        270696 by: Casey

Re: What design patterns do you usually use?
        270714 by: Zoltán Németh

Re: auto-wrap on posts
        270716 by: Zoltán Németh

Get country from Phone number
        270719 by: Dani Castaños
        270721 by: Andrés Robinet
        270727 by: Dani Castaños
        270728 by: Satyam

simple command help
        270722 by: Shelley
        270725 by: Richard Heyes

Re: Traverse directory - Find empty directory
        270726 by: Holografix

Administrivia:

To subscribe to the digest, e-mail:
        php-general-digest-subscribelists.php.net

To unsubscribe from the digest, e-mail:
        php-general-digest-unsubscribelists.php.net

To post to the list, e-mail:
        php-generallists.php.net

----------------------------------------------------------------------

attached mail follows:


On Thu, Feb 28, 2008 at 4:22 PM, Jim Lucas <listscmsws.com> wrote:

> So, I guess my question would be, why not take it one level deeper.
>
> <?php
> include('ArrayClass.php');
>
> function sillyFunc() {
> return ArrayClass::create(array('a' => 1, 'b' => 2, 'c' => 3, 'd' =>
> 4));
> }
>
> echo sillyFunc()->a . PHP_EOL;
> ?>

the idea is that you get something that can be used repeatedly. in your
example you are creating the array that is supplied to the
ArrayClass::create() method, whereas in mine it is supplied by something
else. of course you could create a global function that wraps the
ArrayClass::create() method, and in that case it might make sense to leave
the constructor public and just wrap the instantiation of the ArrayClass
class. but thats why i created the static method in the first place, that
and the issue we observed a while back about not being able to invoke a
method on an object in the same statement that instantiates it.

-nathan

attached mail follows:


On Thu, Feb 28, 2008 at 6:14 PM, Nathan Rixham <nrixhamgmail.com> wrote:

> if I show you guys how to do this:
>
> echo sillyFunc()['a'] . PHP_EOL;
>
> using a few brackets and things do you promise not to laugh?
> *it's a bit weird*

id like to see it.

-nathan

attached mail follows:


Nathan Nobbe wrote:
> On Thu, Feb 28, 2008 at 6:14 PM, Nathan Rixham <nrixhamgmail.com> wrote:
>
>> if I show you guys how to do this:
>>
>> echo sillyFunc()['a'] . PHP_EOL;
>>
>> using a few brackets and things do you promise not to laugh?
>> *it's a bit weird*
>
>
> id like to see it.
>
> -nathan
>

don't say I didn't warn ya fellow nathan!

#!/usr/bin/php
<?php
function sillyFunc() {
        return array('a' => 1, 'b' => 2, 'c' => 3, 'd' => 4, 'e'=>'some string');
}

echo !${~${''}='sillyFunc'}=&${''}().${~${''}}['e'] . PHP_EOL;

--- output ---
some string

To make things a little weirder yet here's the var's lol:

print_r(get_defined_vars());

     [] => sillyFunc
     [¹] => Array
         (
             [a] => 1
             [b] => 2
             [c] => 3
             [d] => 4
             [e] => some string
         )

to reference the var holding "string sillyFunc" (any of):
echo ${''}; echo ${NULL}; echo ${FALSE};

to reference our array [¹] (yeah it is called ¹)
print_r(${~${''}});

here's a quick simplification + alternatives.

echo (!$array = sillyFunc()),$array['e'];
echo (!$array = sillyFunc()).$array['e'];

and a useful ternary one:
echo is_array($array = sillyFunc()) ? $array['e'] : '';

told you it was a bit weird [took me a couple hours to figure out]!

nath :)

attached mail follows:


On Fri, 2008-02-29 at 00:18 +0000, Nathan Rixham wrote:
>
> don't say I didn't warn ya fellow nathan!
>
> #!/usr/bin/php
> <?php
> function sillyFunc() {
> return array('a' => 1, 'b' => 2, 'c' => 3, 'd' => 4, 'e'=>'some string');
> }
>
> echo !${~${''}='sillyFunc'}=&${''}().${~${''}}['e'] . PHP_EOL;

I was ready to use this system everywhere in my code until I saw that it
generates an E_STRICT... now I'll just have to keep with what I usually
do.

Cheers,
Rob.
--
.------------------------------------------------------------.
| InterJinn Application Framework - http://www.interjinn.com |
:------------------------------------------------------------:
| An application and templating framework for PHP. Boasting |
| a powerful, scalable system for accessing system services |
| such as forms, properties, sessions, and caches. InterJinn |
| also provides an extremely flexible architecture for |
| creating re-usable components quickly and easily. |
`------------------------------------------------------------'

attached mail follows:


Robert Cummings wrote:
> On Fri, 2008-02-29 at 00:18 +0000, Nathan Rixham wrote:
>> don't say I didn't warn ya fellow nathan!
>>
>> #!/usr/bin/php
>> <?php
>> function sillyFunc() {
>> return array('a' => 1, 'b' => 2, 'c' => 3, 'd' => 4, 'e'=>'some string');
>> }
>>
>> echo !${~${''}='sillyFunc'}=&${''}().${~${''}}['e'] . PHP_EOL;
>
>
> I was ready to use this system everywhere in my code until I saw that it
> generates an E_STRICT... now I'll just have to keep with what I usually
> do.
>
> Cheers,
> Rob.

fixed :)

#!/usr/bin/php
<?php
error_reporting(E_STRICT);

function sillyFunc() {
         return array('a' => 1, 'b' => 2, 'c' => 3, 'd' => 4, 'e'=>'some
string');
}

#echo !${~${''}='sillyFunc'}=${''}().${~${''}}['e'] . PHP_EOL;

attached mail follows:


Robert Cummings wrote:
> On Fri, 2008-02-29 at 00:18 +0000, Nathan Rixham wrote:
>> don't say I didn't warn ya fellow nathan!
>>
>> #!/usr/bin/php
>> <?php
>> function sillyFunc() {
>> return array('a' => 1, 'b' => 2, 'c' => 3, 'd' => 4, 'e'=>'some string');
>> }
>>
>> echo !${~${''}='sillyFunc'}=&${''}().${~${''}}['e'] . PHP_EOL;
>
>
> I was ready to use this system everywhere in my code until I saw that it
> generates an E_STRICT... now I'll just have to keep with what I usually
> do.
>
> Cheers,
> Rob.

scratch the former!

FIXED>>

echo !(${~${''}='sillyFunc'}=${''}()).${~${''}}['e'] . PHP_EOL;

attached mail follows:


On Fri, 2008-02-29 at 04:04 +0000, Nathan Rixham wrote:
> Robert Cummings wrote:
> > On Fri, 2008-02-29 at 00:18 +0000, Nathan Rixham wrote:
> >> don't say I didn't warn ya fellow nathan!
> >>
> >> #!/usr/bin/php
> >> <?php
> >> function sillyFunc() {
> >> return array('a' => 1, 'b' => 2, 'c' => 3, 'd' => 4, 'e'=>'some string');
> >> }
> >>
> >> echo !${~${''}='sillyFunc'}=&${''}().${~${''}}['e'] . PHP_EOL;
> >
> >
> > I was ready to use this system everywhere in my code until I saw that it
> > generates an E_STRICT... now I'll just have to keep with what I usually
> > do.
> >
> > Cheers,
> > Rob.
>
> scratch the former!
>
> FIXED>>
>
> echo !(${~${''}='sillyFunc'}=${''}()).${~${''}}['e'] . PHP_EOL;

Ok, I lied... I'm not really gonna use it. Interesting tidbit of
obfuscation though.

Cheers,
Rob.
--
.------------------------------------------------------------.
| InterJinn Application Framework - http://www.interjinn.com |
:------------------------------------------------------------:
| An application and templating framework for PHP. Boasting |
| a powerful, scalable system for accessing system services |
| such as forms, properties, sessions, and caches. InterJinn |
| also provides an extremely flexible architecture for |
| creating re-usable components quickly and easily. |
`------------------------------------------------------------'

attached mail follows:


On Thu, 2008-02-28 at 23:27 -0500, Robert Cummings wrote:
> On Fri, 2008-02-29 at 04:04 +0000, Nathan Rixham wrote:
> > Robert Cummings wrote:
> > > On Fri, 2008-02-29 at 00:18 +0000, Nathan Rixham wrote:
> > >> don't say I didn't warn ya fellow nathan!
> > >>
> > >> #!/usr/bin/php
> > >> <?php
> > >> function sillyFunc() {
> > >> return array('a' => 1, 'b' => 2, 'c' => 3, 'd' => 4, 'e'=>'some string');
> > >> }
> > >>
> > >> echo !${~${''}='sillyFunc'}=&${''}().${~${''}}['e'] . PHP_EOL;
> > >
> > >
> > > I was ready to use this system everywhere in my code until I saw that it
> > > generates an E_STRICT... now I'll just have to keep with what I usually
> > > do.
> > >
> > > Cheers,
> > > Rob.
> >
> > scratch the former!
> >
> > FIXED>>
> >
> > echo !(${~${''}='sillyFunc'}=${''}()).${~${''}}['e'] . PHP_EOL;
>
> Ok, I lied... I'm not really gonna use it. Interesting tidbit of
> obfuscation though.

BTW... the following is shorter:

    echo ${~${''}='sillyFunc'}['e'] . PHP_EOL;

Cheers,
Rob.
--
.------------------------------------------------------------.
| InterJinn Application Framework - http://www.interjinn.com |
:------------------------------------------------------------:
| An application and templating framework for PHP. Boasting |
| a powerful, scalable system for accessing system services |
| such as forms, properties, sessions, and caches. InterJinn |
| also provides an extremely flexible architecture for |
| creating re-usable components quickly and easily. |
`------------------------------------------------------------'

attached mail follows:


Robert Cummings wrote:
> On Thu, 2008-02-28 at 23:27 -0500, Robert Cummings wrote:
>> On Fri, 2008-02-29 at 04:04 +0000, Nathan Rixham wrote:
>>> Robert Cummings wrote:
>>>> On Fri, 2008-02-29 at 00:18 +0000, Nathan Rixham wrote:
>>>>> don't say I didn't warn ya fellow nathan!
>>>>>
>>>>> #!/usr/bin/php
>>>>> <?php
>>>>> function sillyFunc() {
>>>>> return array('a' => 1, 'b' => 2, 'c' => 3, 'd' => 4, 'e'=>'some string');
>>>>> }
>>>>>
>>>>> echo !${~${''}='sillyFunc'}=&${''}().${~${''}}['e'] . PHP_EOL;
>>>>
>>>> I was ready to use this system everywhere in my code until I saw that it
>>>> generates an E_STRICT... now I'll just have to keep with what I usually
>>>> do.
>>>>
>>>> Cheers,
>>>> Rob.
>>> scratch the former!
>>>
>>> FIXED>>
>>>
>>> echo !(${~${''}='sillyFunc'}=${''}()).${~${''}}['e'] . PHP_EOL;
>> Ok, I lied... I'm not really gonna use it. Interesting tidbit of
>> obfuscation though.
>
> BTW... the following is shorter:
>
> echo ${~${''}='sillyFunc'}['e'] . PHP_EOL;
>
> Cheers,
> Rob.

but doesn't work over here.. php 5.2.4 && 5

attached mail follows:


On Fri, 2008-02-29 at 04:38 +0000, Nathan Rixham wrote:
> Robert Cummings wrote:
> > On Thu, 2008-02-28 at 23:27 -0500, Robert Cummings wrote:
> >> On Fri, 2008-02-29 at 04:04 +0000, Nathan Rixham wrote:
> >>> Robert Cummings wrote:
> >>>> On Fri, 2008-02-29 at 00:18 +0000, Nathan Rixham wrote:
> >>>>> don't say I didn't warn ya fellow nathan!
> >>>>>
> >>>>> #!/usr/bin/php
> >>>>> <?php
> >>>>> function sillyFunc() {
> >>>>> return array('a' => 1, 'b' => 2, 'c' => 3, 'd' => 4, 'e'=>'some string');
> >>>>> }
> >>>>>
> >>>>> echo !${~${''}='sillyFunc'}=&${''}().${~${''}}['e'] . PHP_EOL;
> >>>>
> >>>> I was ready to use this system everywhere in my code until I saw that it
> >>>> generates an E_STRICT... now I'll just have to keep with what I usually
> >>>> do.
> >>>>
> >>>> Cheers,
> >>>> Rob.
> >>> scratch the former!
> >>>
> >>> FIXED>>
> >>>
> >>> echo !(${~${''}='sillyFunc'}=${''}()).${~${''}}['e'] . PHP_EOL;
> >> Ok, I lied... I'm not really gonna use it. Interesting tidbit of
> >> obfuscation though.
> >
> > BTW... the following is shorter:
> >
> > echo ${~${''}='sillyFunc'}['e'] . PHP_EOL;
> >
> > Cheers,
> > Rob.
>
> but doesn't work over here.. php 5.2.4 && 5

Works in 4.4.8 and 5.2.5

Cheers,
Rob.
--
.------------------------------------------------------------.
| InterJinn Application Framework - http://www.interjinn.com |
:------------------------------------------------------------:
| An application and templating framework for PHP. Boasting |
| a powerful, scalable system for accessing system services |
| such as forms, properties, sessions, and caches. InterJinn |
| also provides an extremely flexible architecture for |
| creating re-usable components quickly and easily. |
`------------------------------------------------------------'

attached mail follows:


On Thu, Feb 28, 2008 at 8:38 PM, Nathan Rixham <nrixhamgmail.com> wrote:
>
> Robert Cummings wrote:
> > On Thu, 2008-02-28 at 23:27 -0500, Robert Cummings wrote:
> >> On Fri, 2008-02-29 at 04:04 +0000, Nathan Rixham wrote:
> >>> Robert Cummings wrote:
> >>>> On Fri, 2008-02-29 at 00:18 +0000, Nathan Rixham wrote:
> >>>>> don't say I didn't warn ya fellow nathan!
> >>>>>
> >>>>> #!/usr/bin/php
> >>>>> <?php
> >>>>> function sillyFunc() {
> >>>>> return array('a' => 1, 'b' => 2, 'c' => 3, 'd' => 4, 'e'=>'some string');
> >>>>> }
> >>>>>
> >>>>> echo !${~${''}='sillyFunc'}=&${''}().${~${''}}['e'] . PHP_EOL;
> >>>>
> >>>> I was ready to use this system everywhere in my code until I saw that it
> >>>> generates an E_STRICT... now I'll just have to keep with what I usually
> >>>> do.
> >>>>
> >>>> Cheers,
> >>>> Rob.
> >>> scratch the former!
> >>>
> >>> FIXED>>
> >>>
> >>> echo !(${~${''}='sillyFunc'}=${''}()).${~${''}}['e'] . PHP_EOL;
> >> Ok, I lied... I'm not really gonna use it. Interesting tidbit of
> >> obfuscation though.
> >
> > BTW... the following is shorter:
> >
> > echo ${~${''}='sillyFunc'}['e'] . PHP_EOL;
> >
> > Cheers,
> > Rob.
>
> but doesn't work over here.. php 5.2.4 && 5
>
>
>
Doesn't work for me either. Here's mine:

        function ReturnArray() {
                return array('a' => 'f', 'b' => 'g', 'c' => 'h', 'd' => 'i', 'e' => 'j');
        }
        echo ${(${0}=ReturnArray())&0}['a'];

--
-Casey

attached mail follows:


On Thu, 2008-02-28 at 20:42 -0800, Casey wrote:
> On Thu, Feb 28, 2008 at 8:38 PM, Nathan Rixham <nrixhamgmail.com> wrote:
> >
> > Robert Cummings wrote:
> > > On Thu, 2008-02-28 at 23:27 -0500, Robert Cummings wrote:
> > >> On Fri, 2008-02-29 at 04:04 +0000, Nathan Rixham wrote:
> > >>> Robert Cummings wrote:
> > >>>> On Fri, 2008-02-29 at 00:18 +0000, Nathan Rixham wrote:
> > >>>>> don't say I didn't warn ya fellow nathan!
> > >>>>>
> > >>>>> #!/usr/bin/php
> > >>>>> <?php
> > >>>>> function sillyFunc() {
> > >>>>> return array('a' => 1, 'b' => 2, 'c' => 3, 'd' => 4, 'e'=>'some string');
> > >>>>> }
> > >>>>>
> > >>>>> echo !${~${''}='sillyFunc'}=&${''}().${~${''}}['e'] . PHP_EOL;
> > >>>>
> > >>>> I was ready to use this system everywhere in my code until I saw that it
> > >>>> generates an E_STRICT... now I'll just have to keep with what I usually
> > >>>> do.
> > >>>>
> > >>>> Cheers,
> > >>>> Rob.
> > >>> scratch the former!
> > >>>
> > >>> FIXED>>
> > >>>
> > >>> echo !(${~${''}='sillyFunc'}=${''}()).${~${''}}['e'] . PHP_EOL;
> > >> Ok, I lied... I'm not really gonna use it. Interesting tidbit of
> > >> obfuscation though.
> > >
> > > BTW... the following is shorter:
> > >
> > > echo ${~${''}='sillyFunc'}['e'] . PHP_EOL;
> > >
> > > Cheers,
> > > Rob.
> >
> > but doesn't work over here.. php 5.2.4 && 5
> >
> >
> >
> Doesn't work for me either. Here's mine:
>
> function ReturnArray() {
> return array('a' => 'f', 'b' => 'g', 'c' => 'h', 'd' => 'i', 'e' => 'j');
> }
> echo ${(${0}=ReturnArray())&0}['a'];

That's definitely superior... you can even give parameters.

Cheers,
Rob.
--
.------------------------------------------------------------.
| InterJinn Application Framework - http://www.interjinn.com |
:------------------------------------------------------------:
| An application and templating framework for PHP. Boasting |
| a powerful, scalable system for accessing system services |
| such as forms, properties, sessions, and caches. InterJinn |
| also provides an extremely flexible architecture for |
| creating re-usable components quickly and easily. |
`------------------------------------------------------------'

attached mail follows:


On Thu, Feb 28, 2008 at 8:42 PM, Casey <heavyccaseygmail.com> wrote:
>
> On Thu, Feb 28, 2008 at 8:38 PM, Nathan Rixham <nrixhamgmail.com> wrote:
> >
> > Robert Cummings wrote:
> > > On Thu, 2008-02-28 at 23:27 -0500, Robert Cummings wrote:
> > >> On Fri, 2008-02-29 at 04:04 +0000, Nathan Rixham wrote:
> > >>> Robert Cummings wrote:
> > >>>> On Fri, 2008-02-29 at 00:18 +0000, Nathan Rixham wrote:
> > >>>>> don't say I didn't warn ya fellow nathan!
> > >>>>>
> > >>>>> #!/usr/bin/php
> > >>>>> <?php
> > >>>>> function sillyFunc() {
> > >>>>> return array('a' => 1, 'b' => 2, 'c' => 3, 'd' => 4, 'e'=>'some string');
> > >>>>> }
> > >>>>>
> > >>>>> echo !${~${''}='sillyFunc'}=&${''}().${~${''}}['e'] . PHP_EOL;
> > >>>>
> > >>>> I was ready to use this system everywhere in my code until I saw that it
> > >>>> generates an E_STRICT... now I'll just have to keep with what I usually
> > >>>> do.
> > >>>>
> > >>>> Cheers,
> > >>>> Rob.
> > >>> scratch the former!
> > >>>
> > >>> FIXED>>
> > >>>
> > >>> echo !(${~${''}='sillyFunc'}=${''}()).${~${''}}['e'] . PHP_EOL;
> > >> Ok, I lied... I'm not really gonna use it. Interesting tidbit of
> > >> obfuscation though.
> > >
> > > BTW... the following is shorter:
> > >
> > > echo ${~${''}='sillyFunc'}['e'] . PHP_EOL;
> > >
> > > Cheers,
> > > Rob.
> >
> > but doesn't work over here.. php 5.2.4 && 5
> >
> >
> >
> Doesn't work for me either. Here's mine:
>
> function ReturnArray() {
> return array('a' => 'f', 'b' => 'g', 'c' => 'h', 'd' => 'i', 'e' => 'j');
> }
> echo ${(${0}=ReturnArray())&0}['a'];
>
> --
> -Casey
>

By the way, this could be compressed simply to

echo ${!${!1}=ReturnArray()}['a'];

I don't know why I'm continuing this... but for the truly crazy:
        function w(&$t) {
                $t = array('f' => '...');
                return 't';
        }
        
        echo ${w($t)}['f'];

--
-Casey

attached mail follows:


Casey wrote:
>
> I don't know why I'm continuing this... but for the truly crazy:
> function w(&$t) {
> $t = array('f' => '...');
> return 't';
> }
>
> echo ${w($t)}['f'];
>

addictive isn't it!

casey, I truelly believe that's as short as it can get - and a great bit
of code reduction - most impressed :D

concider: w()['f']
the only additions are a ${} wrapper!

nice

attached mail follows:


On Fri, 2008-02-29 at 05:34 +0000, Nathan Rixham wrote:
> Casey wrote:
> >
> > I don't know why I'm continuing this... but for the truly crazy:
> > function w(&$t) {
> > $t = array('f' => '...');
> > return 't';
> > }
> >
> > echo ${w($t)}['f'];
> >
>
> addictive isn't it!
>
> casey, I truelly believe that's as short as it can get - and a great bit
> of code reduction - most impressed :D
>
> concider: w()['f']

I'm sure you meant consider. Concider sounds like fake cider ;)

> the only additions are a ${} wrapper!

Doesn't work that way, he needs the reference in that last one. The last
one is a pseudo solution since it requires the helper reference which
gets littered in the calling scope.

Cheers,
Rob.
--
.------------------------------------------------------------.
| InterJinn Application Framework - http://www.interjinn.com |
:------------------------------------------------------------:
| An application and templating framework for PHP. Boasting |
| a powerful, scalable system for accessing system services |
| such as forms, properties, sessions, and caches. InterJinn |
| also provides an extremely flexible architecture for |
| creating re-usable components quickly and easily. |
`------------------------------------------------------------'

attached mail follows:


wow, im going to have to stare at some of those and play around with them as
soon as im half awake :)

of course i still like my solution ;) but im excited about the
experimentation and ideas that have been shared on this topic, very
interesting really!

-nathan

attached mail follows:


Wolf wrote:
> skylark wrote:
>> Hi guys,
>>
>> Relex a little on the topic "What design patterns do you usually use".
>> Choose the ones you use often at: http:// phparch [dot] cn
>> And this will answer that question, isn't it?
>>
>> Those options are the ones that we often use. If there is any option
>> needed
>> to be replaced, just let me know.
>> You can choose 2, 3, 4, ... or even more.... :-)
>> And you can check the result if interested.
>>
>> Ill report the results regularly if needed. :)
>>
> You are really hooked on "Design Patterns" aren't you?
>
>
:( Yes, a little overhooked.

attached mail follows:


2008. 02. 28, csütörtök keltezéssel 11.16-kor skylark ezt írta:
> Hi guys,
>
> Relex a little on the topic "What design patterns do you usually use".
> Choose the ones you use often at: http:// phparch [dot] cn
> And this will answer that question, isn't it?

you should've made the poll with the possibility to vote for more than
one. since you're asking which ones we use, not which one. and most of
us has more than one very frequently used pattern ;)

anyway, I voted for MVC since nowadays I use that one most of the time

greets
Zoltán Németh

>
> Those options are the ones that we often use. If there is any option needed
> to be replaced, just let me know.
> You can choose 2, 3, 4, ... or even more.... :-)
> And you can check the result if interested.
>
> Ill report the results regularly if needed. :)
>

attached mail follows:


Hello People,

I wanted to have your assistance in deciding few things here,
basically I want to auto populate a registration form for people
visiting second time or so on.

I have already started a session,I know that session is a cookie so is
it better to rely upon the session cookie for auto populating or
create another cookie on client side.

If i am not mistaken ini_set('session.gc_maxlifetime', 3600);
increases the time session cookie expiration time to 1 hr right.

Please give me ur suggestions on this. if some one has a working code
can you please share?

Thanks,
V

attached mail follows:


VamVan wrote:
> Hello People,
>
> I wanted to have your assistance in deciding few things here,
> basically I want to auto populate a registration form for people
> visiting second time or so on.
>
> I have already started a session,I know that session is a cookie so is
> it better to rely upon the session cookie for auto populating or
> create another cookie on client side.
>
> If i am not mistaken ini_set('session.gc_maxlifetime', 3600);
> increases the time session cookie expiration time to 1 hr right.
>
> Please give me ur suggestions on this. if some one has a working code
> can you please share?
>
> Thanks,
> V
>

In the example you provide it would be best to use a regular cookie.
Sessions are destroyed and garbage collected quite regularly, so you can
only count on the data being available while they are using your
application (during their session). With cookies you can specify an
expires date so that the information will be available tomorrow, next
week, etc.

You *could* increase the session cookie lifetime, but I wouldn't count
on the data being available through a session, especially if they close
their browser.

--
Ray Hauge
www.primateapplications.com

attached mail follows:


Actually garbage cleanup can be controlled by writing your session handler
functions. You can almost guarantee that noone else will step on your
session (with the possible session of the user who hopes to benefit from
this, by using a unique session id name, its in the manual under something
like set session handlers.

HTH

Warren Vail

> -----Original Message-----
> From: VamVan [mailto:vamseevangmail.com]
> Sent: Thursday, February 28, 2008 5:11 PM
> To: php-generallists.php.net
> Subject: [PHP] Sessions
>
> Hello People,
>
> I wanted to have your assistance in deciding few things here,
> basically I want to auto populate a registration form for people
> visiting second time or so on.
>
> I have already started a session,I know that session is a cookie so is
> it better to rely upon the session cookie for auto populating or
> create another cookie on client side.
>
> If i am not mistaken ini_set('session.gc_maxlifetime', 3600);
> increases the time session cookie expiration time to 1 hr right.
>
> Please give me ur suggestions on this. if some one has a working code
> can you please share?
>
> Thanks,
> V
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php

attached mail follows:


Hi, I've ran into some problems when outputing text to an image using
imagettftext. I cannot get swedish characters to work, I just get a
square. I've tried different fonts which I know has those characters
(bitstream vera, arial, times new roman, etc). What am I doing wrong?

I know I must pass utf-8 encoded text and I belive I do but I don't know
how to check it.

HTML form code:
(html document uses utf-8 as charset and apache is set to use utf-8 too)

<form action="/index.php/slides/upload" method="post"
accept-charset="utf-8">
<input type="text" id="title" name="title" size="70" value="" />
</form>

/index.php/slides/upload:

$title = htmlentities($_POST['title'], ENT_COMPAT, 'UTF-8');
$image =
'/index.php/slides/preview?title='.urlencode($title).'&content='.urlencode($_POST['content']);

/index.php/slides/preview:

   function preview(){
     $title = html_entity_decode($_GET['title'], ENT_COMPAT, 'UTF-8');
     //$title = $_GET['title'];

     ///note Hardcoded resolution
     $im = imagecreatetruecolor(800, 600);
     $black = imagecolorallocate($im, 0, 0, 0);
     $white = imagecolorallocate($im, 255, 255, 255);
     $font = "/usr/share/fonts/corefonts/georgia.ttf";

     $title_size = 32;

     imagefilledrectangle($im, 0, 0, 800, 600, $black);

     imagettftext( $im, $title_size, 0, 50, 50, $white, $font, $title );
        
     header("Content-Type: image/png");
     imagepng($im);
     exit();
   }

--

//*David Sveningsson [eXt]*

Freelance coder | Game Development Student
http://sidvind.com

Thou shalt make thy program's purpose and structure clear to thy fellow
man by using the One True Brace Style, even if thou likest it not, for
thy creativity is better used in solving problems than in creating
beautiful new impediments to understanding.

attached mail follows:


David Sveningsson wrote:
> Hi, I've ran into some problems when outputing text to an image using
> imagettftext. I cannot get swedish characters to work, I just get a
> square. I've tried different fonts which I know has those characters
> (bitstream vera, arial, times new roman, etc). What am I doing wrong?
>
> I know I must pass utf-8 encoded text and I belive I do but I don't know
> how to check it.
>
> HTML form code:
> (html document uses utf-8 as charset and apache is set to use utf-8 too)
>
> <form action="/index.php/slides/upload" method="post"
> accept-charset="utf-8">
> <input type="text" id="title" name="title" size="70" value="" />
> </form>
>
> /index.php/slides/upload:
>
> $title = htmlentities($_POST['title'], ENT_COMPAT, 'UTF-8');
> $image =
> '/index.php/slides/preview?title='.urlencode($title).'&content='.urlencode($_POST['content']);
>
>
> /index.php/slides/preview:
>
> function preview(){
> $title = html_entity_decode($_GET['title'], ENT_COMPAT, 'UTF-8');
> //$title = $_GET['title'];
>
> ///note Hardcoded resolution
> $im = imagecreatetruecolor(800, 600);
> $black = imagecolorallocate($im, 0, 0, 0);
> $white = imagecolorallocate($im, 255, 255, 255);
> $font = "/usr/share/fonts/corefonts/georgia.ttf";
>
> $title_size = 32;
>
> imagefilledrectangle($im, 0, 0, 800, 600, $black);
>
> imagettftext( $im, $title_size, 0, 50, 50, $white, $font, $title );
>
> header("Content-Type: image/png");
> imagepng($im);
> exit();
> }
>

try changing:
imagettftext( $im, $title_size, 0, 50, 50, $white, $font, $title );

to:
imagettftext($im, $title_size, 0, 50, 50, $white, $font,
utf8_decode($title));

attached mail follows:


Nathan Rixham skrev:
> try changing:
> imagettftext( $im, $title_size, 0, 50, 50, $white, $font, $title );
>
> to:
> imagettftext($im, $title_size, 0, 50, 50, $white, $font,
> utf8_decode($title));
>

It draws lesser squares, but no characters (except for the regular
alphanum characters which is rendered correctly, as before).

--

//*David Sveningsson [eXt]*

Freelance coder | Game Development Student
http://sidvind.com

Thou shalt make thy program's purpose and structure clear to thy fellow
man by using the One True Brace Style, even if thou likest it not, for
thy creativity is better used in solving problems than in creating
beautiful new impediments to understanding.

attached mail follows:


Nathan Rixham wrote:
> David Sveningsson wrote:
>> Hi, I've ran into some problems when outputing text to an image using
>> imagettftext. I cannot get swedish characters to work, I just get a
>> square. I've tried different fonts which I know has those characters
>> (bitstream vera, arial, times new roman, etc). What am I doing wrong?
>>
>> I know I must pass utf-8 encoded text and I belive I do but I don't
>> know how to check it.
>>
>> HTML form code:
>> (html document uses utf-8 as charset and apache is set to use utf-8 too)
>>
>> <form action="/index.php/slides/upload" method="post"
>> accept-charset="utf-8">
>> <input type="text" id="title" name="title" size="70" value="" />
>> </form>
>>
>> /index.php/slides/upload:
>>
>> $title = htmlentities($_POST['title'], ENT_COMPAT, 'UTF-8');
>> $image =
>> '/index.php/slides/preview?title='.urlencode($title).'&content='.urlencode($_POST['content']);
>>
>>
>> /index.php/slides/preview:
>>
>> function preview(){
>> $title = html_entity_decode($_GET['title'], ENT_COMPAT, 'UTF-8');
>> //$title = $_GET['title'];
>>
>> ///note Hardcoded resolution
>> $im = imagecreatetruecolor(800, 600);
>> $black = imagecolorallocate($im, 0, 0, 0);
>> $white = imagecolorallocate($im, 255, 255, 255);
>> $font = "/usr/share/fonts/corefonts/georgia.ttf";
>>
>> $title_size = 32;
>>
>> imagefilledrectangle($im, 0, 0, 800, 600, $black);
>>
>> imagettftext( $im, $title_size, 0, 50, 50, $white, $font, $title );
>> header("Content-Type: image/png");
>> imagepng($im);
>> exit();
>> }
>>
>
> try changing:
> imagettftext( $im, $title_size, 0, 50, 50, $white, $font, $title );
>
> to:
> imagettftext($im, $title_size, 0, 50, 50, $white, $font,
> utf8_decode($title));

before going any further, your HTML page is in UTF-8 yes? with the
appropriate content-type line.

plus: first debugging step:

function preview(){
$title = html_entity_decode($_GET['title'], ENT_COMPAT, 'UTF-8');
print_r($title); #verify in view source / web browser that data is
correct before it's sent to imagettftext

attached mail follows:


Nathan Rixham skrev:
> before going any further, your HTML page is in UTF-8 yes? with the
> appropriate content-type line.

Yes, apache uses only utf-8 as charset and the html content-type meta
tag is set to utf-8 too. Also, the html form validates at validator.w3.org

>
> plus: first debugging step:
>
> function preview(){
> $title = html_entity_decode($_GET['title'], ENT_COMPAT, 'UTF-8');
> print_r($title); #verify in view source / web browser that data is
> correct before it's sent to imagettftext
>

I see the characters correctly, and page info in firefox says the
encoding is utf-8.

--

//*David Sveningsson [eXt]*

Freelance coder | Game Development Student
http://sidvind.com

Thou shalt make thy program's purpose and structure clear to thy fellow
man by using the One True Brace Style, even if thou likest it not, for
thy creativity is better used in solving problems than in creating
beautiful new impediments to understanding.

attached mail follows:


I recently migrated some php scripts from a box running php 4.4.4 to php
5.2.5. due to the nature of the data, some of the php scripts require
handling dates before 1901. both boxes are 64-bit (original and new),
however the new box isn't handling dates properly before 1901 with
either the mktime() or strtotime() functions. it was working perfectly
on the old box and I'm stumped as to why it stopped working on the new
one. did the mktime() and strtotime() functions in php 5 regress to
handling the dates as 32-bit ints?

here's an example of some php code to test between the two boxes:

<?php

echo "12-13-1901: ".mktime(0,0,0, 12, 13, 1901)."\n";
echo "12-14-1901: ".mktime(0,0,0, 12, 14, 1901)."\n";

echo "1-18-2038: ".mktime(0,0,0, 1, 18, 2038)."\n";
echo "1-19-2038: ".mktime(0,0,0, 1, 19, 2038)."\n";

echo "12-13-1901: ".strtotime("12/13/1901")."\n";
echo "12-14-1901: ".strtotime("12/14/1901")."\n";

?>

output of code on old box:

        12-13-1901: -2147529600
        12-14-1901: -2147443200
        1-18-2038: 2147414400
        1-19-2038: 2147500800
        12-13-1901: -2147529600
        12-14-1901: -2147443200

output of code on new box:

        12-13-1901:
        12-14-1901: -2147443200
        1-18-2038: 2147414400
        1-19-2038:
        12-13-1901:
        12-14-1901: -2147443200

thanks much ...

-----
Gabriel Kuri | Sr. Network Engineer
Instructional and Information Technology Division
California State Polytechnic University, Pomona
http://www.csupomona.edu/~iit | +1 909 979 6363

attached mail follows:


Gabriel Kuri wrote:
> I recently migrated some php scripts from a box running php 4.4.4 to php
> 5.2.5. due to the nature of the data, some of the php scripts require
> handling dates before 1901. both boxes are 64-bit (original and new),
> however the new box isn't handling dates properly before 1901 with
> either the mktime() or strtotime() functions. it was working perfectly
> on the old box and I'm stumped as to why it stopped working on the new
> one. did the mktime() and strtotime() functions in php 5 regress to
> handling the dates as 32-bit ints?
>
> here's an example of some php code to test between the two boxes:
>
> <?php
>
> echo "12-13-1901: ".mktime(0,0,0, 12, 13, 1901)."\n";
> echo "12-14-1901: ".mktime(0,0,0, 12, 14, 1901)."\n";
>
> echo "1-18-2038: ".mktime(0,0,0, 1, 18, 2038)."\n";
> echo "1-19-2038: ".mktime(0,0,0, 1, 19, 2038)."\n";
>
> echo "12-13-1901: ".strtotime("12/13/1901")."\n";
> echo "12-14-1901: ".strtotime("12/14/1901")."\n";
>
> ?>
>
>
> output of code on old box:
>
> 12-13-1901: -2147529600
> 12-14-1901: -2147443200
> 1-18-2038: 2147414400
> 1-19-2038: 2147500800
> 12-13-1901: -2147529600
> 12-14-1901: -2147443200
>
> output of code on new box:
>
> 12-13-1901:
> 12-14-1901: -2147443200
> 1-18-2038: 2147414400
> 1-19-2038:
> 12-13-1901:
> 12-14-1901: -2147443200
>
> thanks much ...
>
>
> -----
> Gabriel Kuri | Sr. Network Engineer
> Instructional and Information Technology Division
> California State Polytechnic University, Pomona
> http://www.csupomona.edu/~iit | +1 909 979 6363

same os on both boxes? + which versions

attached mail follows:


old box - Ubuntu 6.06LTS (Dapper Drake) 64-bit

new box - Gentoo Linux 64-bit

-----
Gabriel Kuri | Sr. Network Engineer
Instructional and Information Technology Division
California State Polytechnic University, Pomona
http://www.csupomona.edu/~iit | +1 909 979 6363

> -----Original Message-----
> From: Nathan Rixham [mailto:nrixhamgmail.com]
> Sent: Thursday, February 28, 2008 6:43 PM
> To: php-generallists.php.net
> Subject: [PHP] Re: handling dates before 1901
>
> Gabriel Kuri wrote:
> > I recently migrated some php scripts from a box running php
> 4.4.4 to php
> > 5.2.5. due to the nature of the data, some of the php
> scripts require
> > handling dates before 1901. both boxes are 64-bit (original
> and new),
> > however the new box isn't handling dates properly before 1901 with
> > either the mktime() or strtotime() functions. it was
> working perfectly
> > on the old box and I'm stumped as to why it stopped working
> on the new
> > one. did the mktime() and strtotime() functions in php 5 regress to
> > handling the dates as 32-bit ints?
> >
> > here's an example of some php code to test between the two boxes:
> >
> > <?php
> >
> > echo "12-13-1901: ".mktime(0,0,0, 12, 13, 1901)."\n";
> > echo "12-14-1901: ".mktime(0,0,0, 12, 14, 1901)."\n";
> >
> > echo "1-18-2038: ".mktime(0,0,0, 1, 18, 2038)."\n";
> > echo "1-19-2038: ".mktime(0,0,0, 1, 19, 2038)."\n";
> >
> > echo "12-13-1901: ".strtotime("12/13/1901")."\n";
> > echo "12-14-1901: ".strtotime("12/14/1901")."\n";
> >
> > ?>
> >
> >
> > output of code on old box:
> >
> > 12-13-1901: -2147529600
> > 12-14-1901: -2147443200
> > 1-18-2038: 2147414400
> > 1-19-2038: 2147500800
> > 12-13-1901: -2147529600
> > 12-14-1901: -2147443200
> >
> > output of code on new box:
> >
> > 12-13-1901:
> > 12-14-1901: -2147443200
> > 1-18-2038: 2147414400
> > 1-19-2038:
> > 12-13-1901:
> > 12-14-1901: -2147443200
> >
> > thanks much ...
> >
> >
> > -----
> > Gabriel Kuri | Sr. Network Engineer
> > Instructional and Information Technology Division
> > California State Polytechnic University, Pomona
> > http://www.csupomona.edu/~iit | +1 909 979 6363
>
> same os on both boxes? + which versions
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

attached mail follows:


I don't know why it would have been working before and now stopped, but take a
look at the DateTime class in PHP 5.2. It is designed to use 64-bit dates
internally so it should handle a larger date range than humans have existed
for. It has both OOP and procedural routines, depending on your preference.

http://www.php.net/manual/en/function.date-create.php

On Thursday 28 February 2008, Gabriel Kuri wrote:
> I recently migrated some php scripts from a box running php 4.4.4 to php
> 5.2.5. due to the nature of the data, some of the php scripts require
> handling dates before 1901. both boxes are 64-bit (original and new),
> however the new box isn't handling dates properly before 1901 with
> either the mktime() or strtotime() functions. it was working perfectly
> on the old box and I'm stumped as to why it stopped working on the new
> one. did the mktime() and strtotime() functions in php 5 regress to
> handling the dates as 32-bit ints?
>
> here's an example of some php code to test between the two boxes:
>
> <?php
>
> echo "12-13-1901: ".mktime(0,0,0, 12, 13, 1901)."\n";
> echo "12-14-1901: ".mktime(0,0,0, 12, 14, 1901)."\n";
>
> echo "1-18-2038: ".mktime(0,0,0, 1, 18, 2038)."\n";
> echo "1-19-2038: ".mktime(0,0,0, 1, 19, 2038)."\n";
>
> echo "12-13-1901: ".strtotime("12/13/1901")."\n";
> echo "12-14-1901: ".strtotime("12/14/1901")."\n";
>
> ?>
>
>
> output of code on old box:
>
> 12-13-1901: -2147529600
> 12-14-1901: -2147443200
> 1-18-2038: 2147414400
> 1-19-2038: 2147500800
> 12-13-1901: -2147529600
> 12-14-1901: -2147443200
>
> output of code on new box:
>
> 12-13-1901:
> 12-14-1901: -2147443200
> 1-18-2038: 2147414400
> 1-19-2038:
> 12-13-1901:
> 12-14-1901: -2147443200
>
> thanks much ...
>
>
> -----
> Gabriel Kuri | Sr. Network Engineer
> Instructional and Information Technology Division
> California State Polytechnic University, Pomona
> http://www.csupomona.edu/~iit | +1 909 979 6363

--
Larry Garfield AIM: LOLG42
larrygarfieldtech.com ICQ: 6817012

"If nature has made any one thing less susceptible than all others of
exclusive property, it is the action of the thinking power called an idea,
which an individual may exclusively possess as long as he keeps it to
himself; but the moment it is divulged, it forces itself into the possession
of every one, and the receiver cannot dispossess himself of it." -- Thomas
Jefferson

attached mail follows:


I'm trying to figure out a way to make sure an included PHP file has no syntax
errors before actually including it as a part of project. Is this even
possible? I'm running into brick walls.

--
Slainte,
Richard S. Crawford
Editor-in-chief, Daikaijuzine (http://www.daikaijuzine.com)
Personal website: http://www.mossroot.com

attached mail follows:


On Thu, Feb 28, 2008 at 9:58 PM, Richard S. Crawford <
rscrawfordmossroot.com> wrote:

> I'm trying to figure out a way to make sure an included PHP file has no
> syntax
> errors before actually including it as a part of project. Is this even
> possible? I'm running into brick walls.
>
>

The include itself or the contents in the include file? If you use
require() instead of include(), your script will error out if there are any
issues with the inclusion of the file.

--
-Dan Joseph

"Build a man a fire, and he will be warm for the rest of the day.
Light a man on fire, and will be warm for the rest of his life."

attached mail follows:


On Thu, 2008-02-28 at 18:58 -0800, Richard S. Crawford wrote:
> I'm trying to figure out a way to make sure an included PHP file has no syntax
> errors before actually including it as a part of project. Is this even
> possible? I'm running into brick walls.

I don't believe there is a function to do this. What can be done though
is to call the cli binary with the -l flag and have the file syntax
checked that way.

    php -l /path/to/the/source

It wouldn't be very fast though as a solution.

Cheers,
Rob.
--
.------------------------------------------------------------.
| InterJinn Application Framework - http://www.interjinn.com |
:------------------------------------------------------------:
| An application and templating framework for PHP. Boasting |
| a powerful, scalable system for accessing system services |
| such as forms, properties, sessions, and caches. InterJinn |
| also provides an extremely flexible architecture for |
| creating re-usable components quickly and easily. |
`------------------------------------------------------------'

attached mail follows:


On Thu, Feb 28, 2008 at 7:50 PM, Robert Cummings <robertinterjinn.com> wrote:
>
> On Thu, 2008-02-28 at 18:58 -0800, Richard S. Crawford wrote:
> > I'm trying to figure out a way to make sure an included PHP file has no syntax
> > errors before actually including it as a part of project. Is this even
> > possible? I'm running into brick walls.
>
> I don't believe there is a function to do this. What can be done though
> is to call the cli binary with the -l flag and have the file syntax
> checked that way.
>
> php -l /path/to/the/source
>
> It wouldn't be very fast though as a solution.
>
> Cheers,
> Rob.
> --
> .------------------------------------------------------------.
> | InterJinn Application Framework - http://www.interjinn.com |
> :------------------------------------------------------------:
> | An application and templating framework for PHP. Boasting |
> | a powerful, scalable system for accessing system services |
> | such as forms, properties, sessions, and caches. InterJinn |
> | also provides an extremely flexible architecture for |
> | creating re-usable components quickly and easily. |
> `------------------------------------------------------------'
>
>
>

http://us.php.net/manual/en/function.php-check-syntax.php

--
-Casey

attached mail follows:


On Thu, 2008-02-28 at 20:17 -0800, Casey wrote:
> On Thu, Feb 28, 2008 at 7:50 PM, Robert Cummings <robertinterjinn.com> wrote:
> >
> > On Thu, 2008-02-28 at 18:58 -0800, Richard S. Crawford wrote:
> > > I'm trying to figure out a way to make sure an included PHP file has no syntax
> > > errors before actually including it as a part of project. Is this even
> > > possible? I'm running into brick walls.
> >
> > I don't believe there is a function to do this. What can be done though
> > is to call the cli binary with the -l flag and have the file syntax
> > checked that way.
> >
> > php -l /path/to/the/source
> >
> > It wouldn't be very fast though as a solution.
>
> http://us.php.net/manual/en/function.php-check-syntax.php

Doh! Time for me to start trawling the PHP site again to acquaint myself
with all the new functions :) I probably would have found it though if
searching the site's functions for syntax didn't take me directly to the
documentation for soundex().

Cheers,
Rob.
--
.------------------------------------------------------------.
| InterJinn Application Framework - http://www.interjinn.com |
:------------------------------------------------------------:
| An application and templating framework for PHP. Boasting |
| a powerful, scalable system for accessing system services |
| such as forms, properties, sessions, and caches. InterJinn |
| also provides an extremely flexible architecture for |
| creating re-usable components quickly and easily. |
`------------------------------------------------------------'

attached mail follows:


Robert Cummings wrote:
> On Thu, 2008-02-28 at 20:17 -0800, Casey wrote:
>> On Thu, Feb 28, 2008 at 7:50 PM, Robert Cummings <robertinterjinn.com> wrote:
>>> On Thu, 2008-02-28 at 18:58 -0800, Richard S. Crawford wrote:
>>> > I'm trying to figure out a way to make sure an included PHP file has no syntax
>>> > errors before actually including it as a part of project. Is this even
>>> > possible? I'm running into brick walls.
>>>
>>> I don't believe there is a function to do this. What can be done though
>>> is to call the cli binary with the -l flag and have the file syntax
>>> checked that way.
>>>
>>> php -l /path/to/the/source
>>>
>>> It wouldn't be very fast though as a solution.
>> http://us.php.net/manual/en/function.php-check-syntax.php
>
> Doh! Time for me to start trawling the PHP site again to acquaint myself
> with all the new functions :) I probably would have found it though if
> searching the site's functions for syntax didn't take me directly to the
> documentation for soundex().
>
> Cheers,
> Rob.

Point to be noted. Check the first note.

Note: For technical reasons, this function is deprecated and removed
from PHP. Instead, use php -l somefile.php from the commandline.

attached mail follows:


On Thu, 2008-02-28 at 20:46 -0800, Jim Lucas wrote:
> Robert Cummings wrote:
> > On Thu, 2008-02-28 at 20:17 -0800, Casey wrote:
> >> On Thu, Feb 28, 2008 at 7:50 PM, Robert Cummings <robertinterjinn.com> wrote:
> >>> On Thu, 2008-02-28 at 18:58 -0800, Richard S. Crawford wrote:
> >>> > I'm trying to figure out a way to make sure an included PHP file has no syntax
> >>> > errors before actually including it as a part of project. Is this even
> >>> > possible? I'm running into brick walls.
> >>>
> >>> I don't believe there is a function to do this. What can be done though
> >>> is to call the cli binary with the -l flag and have the file syntax
> >>> checked that way.
> >>>
> >>> php -l /path/to/the/source
> >>>
> >>> It wouldn't be very fast though as a solution.
> >> http://us.php.net/manual/en/function.php-check-syntax.php
> >
> > Doh! Time for me to start trawling the PHP site again to acquaint myself
> > with all the new functions :) I probably would have found it though if
> > searching the site's functions for syntax didn't take me directly to the
> > documentation for soundex().
> >
> > Cheers,
> > Rob.
>
> Point to be noted. Check the first note.
>
> Note: For technical reasons, this function is deprecated and removed
> from PHP. Instead, use php -l somefile.php from the commandline.

That's funny given the thread so far :D

Cheers,
Rob.
--
.------------------------------------------------------------.
| InterJinn Application Framework - http://www.interjinn.com |
:------------------------------------------------------------:
| An application and templating framework for PHP. Boasting |
| a powerful, scalable system for accessing system services |
| such as forms, properties, sessions, and caches. InterJinn |
| also provides an extremely flexible architecture for |
| creating re-usable components quickly and easily. |
`------------------------------------------------------------'

attached mail follows:


Robert Cummings wrote:
> On Thu, 2008-02-28 at 20:46 -0800, Jim Lucas wrote:
>> Robert Cummings wrote:
>>> On Thu, 2008-02-28 at 20:17 -0800, Casey wrote:
>>>> On Thu, Feb 28, 2008 at 7:50 PM, Robert Cummings <robertinterjinn.com> wrote:
>>>>> On Thu, 2008-02-28 at 18:58 -0800, Richard S. Crawford wrote:
>>>>> > I'm trying to figure out a way to make sure an included PHP file has no syntax
>>>>> > errors before actually including it as a part of project. Is this even
>>>>> > possible? I'm running into brick walls.
>>>>>
>>>>> I don't believe there is a function to do this. What can be done though
>>>>> is to call the cli binary with the -l flag and have the file syntax
>>>>> checked that way.
>>>>>
>>>>> php -l /path/to/the/source
>>>>>
>>>>> It wouldn't be very fast though as a solution.
>>>> http://us.php.net/manual/en/function.php-check-syntax.php
>>> Doh! Time for me to start trawling the PHP site again to acquaint myself
>>> with all the new functions :) I probably would have found it though if
>>> searching the site's functions for syntax didn't take me directly to the
>>> documentation for soundex().
>>>
>>> Cheers,
>>> Rob.
>> Point to be noted. Check the first note.
>>
>> Note: For technical reasons, this function is deprecated and removed
>> from PHP. Instead, use php -l somefile.php from the commandline.
>
> That's funny given the thread so far :D
>
> Cheers,
> Rob.

It isn't my words. Look at the versions the function is available for.

PHP 5 <= 5.0.4

attached mail follows:


On Thu, 2008-02-28 at 20:53 -0800, Jim Lucas wrote:
> Robert Cummings wrote:
> > On Thu, 2008-02-28 at 20:46 -0800, Jim Lucas wrote:
> >> Robert Cummings wrote:
> >>> On Thu, 2008-02-28 at 20:17 -0800, Casey wrote:
> >>>> On Thu, Feb 28, 2008 at 7:50 PM, Robert Cummings <robertinterjinn.com> wrote:
> >>>>> On Thu, 2008-02-28 at 18:58 -0800, Richard S. Crawford wrote:
> >>>>> > I'm trying to figure out a way to make sure an included PHP file has no syntax
> >>>>> > errors before actually including it as a part of project. Is this even
> >>>>> > possible? I'm running into brick walls.
> >>>>>
> >>>>> I don't believe there is a function to do this. What can be done though
> >>>>> is to call the cli binary with the -l flag and have the file syntax
> >>>>> checked that way.
> >>>>>
> >>>>> php -l /path/to/the/source
> >>>>>
> >>>>> It wouldn't be very fast though as a solution.
> >>>> http://us.php.net/manual/en/function.php-check-syntax.php
> >>> Doh! Time for me to start trawling the PHP site again to acquaint myself
> >>> with all the new functions :) I probably would have found it though if
> >>> searching the site's functions for syntax didn't take me directly to the
> >>> documentation for soundex().
> >>>
> >>> Cheers,
> >>> Rob.
> >> Point to be noted. Check the first note.
> >>
> >> Note: For technical reasons, this function is deprecated and removed
> >> from PHP. Instead, use php -l somefile.php from the commandline.
> >
> > That's funny given the thread so far :D
> >
> > Cheers,
> > Rob.
>
> It isn't my words. Look at the versions the function is available for.
>
> PHP 5 <= 5.0.4

I meant funny, in that the solution goes back to what I offered
originally :)

Cheers,
Rob.
--
.------------------------------------------------------------.
| InterJinn Application Framework - http://www.interjinn.com |
:------------------------------------------------------------:
| An application and templating framework for PHP. Boasting |
| a powerful, scalable system for accessing system services |
| such as forms, properties, sessions, and caches. InterJinn |
| also provides an extremely flexible architecture for |
| creating re-usable components quickly and easily. |
`------------------------------------------------------------'

attached mail follows:


Hi list…

All this in the same php:

 

<?

         $folder = 'pictures;

         $load = copy($_FILES['file']['tmp_name'] , $folder . '/' . $_FILES
['file']['name']);

         if ( $load ) {

                   echo "Picture upload!";

         } else {

                   echo "no picture =(";

         }

?>

<form action="" method="post" enctype="multipart/form-data">

    <input type="text" name="folder">

    <input type="submit" value="ADD FOLDER">

    <hr>

    <input type="file" name="file">

    <input type="submit" value="UPLOAD">

</form>

 

When I try the php the echo "no picture =("; is there. How can I do to don’t
appears the message before I upload de picture.

Thanks.

 

 

+ _
   // Emiliano Boragina _

   // Diseño & Comunicación //////////////////
+ _

   // emiliano.boraginagmail.com /
   // 15 40 58 60 02 ///////////////////////////
+ _

 

attached mail follows:


>
> I think that will solve your problem
>
> <?
> if(isset($_POST['submit'])){
> $folder = 'pictures;
>
> $load = copy($_FILES['file']['tmp_name'] , $folder . '/' . $_FILES
> ['file']['name']);
>
> if ( $load ) {
>
> echo "Picture upload!";
>
> } else {
>
> echo "no picture =(";
>
> }
> }
> ?>
>
> <form action="" method="post" enctype="multipart/form-data">
>
> <input type="text" name="folder">
>
> <input type="submit" value="ADD FOLDER">
>
> <hr>
>
> <input type="file" name="file">
>
> <input type="submit" value="UPLOAD">
>
> </form>
>
>
>
> When I try the php the echo "no picture =("; is there. How can I do to
> don't
> appears the message before I upload de picture.
>
> Thanks.
>
>
>
>
>
> +
> _
> // Emiliano Boragina _
>
> // Diseño & Comunicación //////////////////
> +
> _
>
> // emiliano.boraginagmail.com /
> // 15 40 58 60 02 ///////////////////////////
> +
> _
>
>
>
>

--
Have A pleasant Day
Chetan. D. Rane
Location: India
Contact: +91-9986057255
other ID: chetscoolyahoo.com
            chetranerediffmail.com

attached mail follows:


Your script is screwed at the point where you do not close the quote:

 $folder = 'pictures;

-----Original Message-----
From: Emiliano Boragina [mailto:emiliano.boraginagmail.com]
Sent: Thursday, February 28, 2008 11:09 PM
To: php-generallists.php.net
Subject: [PHP] dont print echo

Hi list…

All this in the same php:

 

<?

         $folder = 'pictures;

         $load = copy($_FILES['file']['tmp_name'] , $folder . '/' . $_FILES
['file']['name']);

         if ( $load ) {

                   echo "Picture upload!";

         } else {

                   echo "no picture =(";

         }

?>

<form action="" method="post" enctype="multipart/form-data">

    <input type="text" name="folder">

    <input type="submit" value="ADD FOLDER">

    <hr>

    <input type="file" name="file">

    <input type="submit" value="UPLOAD">

</form>

 

When I try the php the echo "no picture =("; is there. How can I do to don’t
appears the message before I upload de picture.

Thanks.

 

 

+ _
   // Emiliano Boragina _

   // Diseño & Comunicación //////////////////
+ _

   // emiliano.boraginagmail.com /
   // 15 40 58 60 02 ///////////////////////////
+ _

 

attached mail follows:


On Thu, 2008-02-28 at 23:52 +0000, Nathan Rixham wrote:
> Robert Cummings wrote:
> > On Thu, 2008-02-28 at 20:43 +0000, Nathan Rixham wrote:
> >> [snip]
> >> Eric Butera wrote:
> >>> I can hit tab and shift/tab too and it puts in spaces for me.
> >> [snip]
> >> Robert Cummings wrote:
> >> > Uhhhm, I hit the tab button also and it does the right thing (namely
> >> > inserts 4 spaces). Also, when I hit enter it auto tabs.
> >> [snip]
> >>
> >> *kicks zend studio* [and nano and textpad and dreamweaver] :(
> >>
> >> what ide's editor's do you two use? zend's use of javaw is killing my
> >> win2k3 dev machine anyways.
> >
> > I don't use an IDE. I use JOE. It's a terminal based editor. Works the
> > same whether I'm local or remote. The nice thing about linux is how easy
> > it is to make things work the way you want. My browser source viewer
> > links to a PHP wrapper script that pops up a gnome-terminal with the
> > specification to load the JOE editor on the page source. My default
> > editor in linux is JOE. It just works. Plain, simple, 100% keyboard,
> > keystroke macros, etc, etc. I love it. You probably won't :)
>
> couldn't be further from the truth! sounds perfect - I spend most of my
> life in putty anyways, generally using nano to "type".

I did say probably... you may be the only one ;)

> When
> > working I click an icon on my taskbar, it opens three terminals in my
> > favourite layout. I usually use one to edit HTML, one to edit whatever
> > module I'm working on, and another for whatever else needs to be done
> > (CVS commits, CVS updates, SSH, etc).
>
> see I've only recently started using versioning software all the time,
> I'm currenly svn'ing, how does CVS weight up against it?

I need to look into SVN. I've been meaning to take a look at it for over
a year now but the motivation isn't terribly strong since CVS does
everything I need and I have a lot of stuff in CVS. The main problem
with CVS I see is that it can be pig-assed slow when updating. Also it
has deficiencies when handling directories. I imagine whenever I get
around to taking a look at SVN I'll also have a poke at GIT.

> I use a workspace to the right of
> > my dev workspace in which I load my browser for checking layout and
> > JavaScript etc. To the left I have a workspace where I keep a tails on
> > my log files. I rarely tab through more than 3 windows in a workspace
> > and I rarely use the mouse.
> >
> > Cheers,
> > Rob.
>
> snap, keyboard for 99% of things, I seem to have my left hand glued
> around ctrl/shift/tab/z/x/c/v/q
>
> cheers for giving away some of your set up, I'm going to give joe a try!

No problem.

Cheers,
Rob.
--
.------------------------------------------------------------.
| InterJinn Application Framework - http://www.interjinn.com |
:------------------------------------------------------------:
| An application and templating framework for PHP. Boasting |
| a powerful, scalable system for accessing system services |
| such as forms, properties, sessions, and caches. InterJinn |
| also provides an extremely flexible architecture for |
| creating re-usable components quickly and easily. |
`------------------------------------------------------------'

attached mail follows:


2008. 02. 28, csütörtök keltezéssel 20.25-kor Nathan Rixham ezt írta:
> Robert Cummings wrote:
> > On Thu, 2008-02-28 at 19:37 +0000, Stut wrote:
> >> On 28 Feb 2008, at 19:17, Wolf wrote:
> >>> Jason Pruim wrote:
> >>>> My editor automatically replaces like 4 spaces with a tab... Is
> >>>> there a reason not to use tabs instead of spaces? :)
> >>> I use spaces since when I indent with 4 spaces it is significantly
> >>> easier to read the code then with 4 tabs...
> >>>
> >>> 4 spaces are before this
> >>> 4 tabs are before this
> >>>
> >>> Pretty easy to follow code that does
> >>> {
> >>> {
> >>> {
> >>> {
> >>> }
> >>> }
> >>> }
> >>> }
> >>>
> >>> Versus the alternative, especially with the character wrapping in vi
> >>> and other text editors.
> >>>
> >>> At least, that's IMO
> >>>
> >>> YMMV
> >> Except that if I inherit your code and I find it easier if it's
> >> indented to 8 spaces you've taken that choice away from me. Tabs are
> >> configurable on nearly all editors that exist in the world. If yours
> >> doesn't let you change the tab width, get a new one. But if you don't
> >> care about people who might end up working on your stuff, keep using
> >> spaces. Just hope you never change your mind.
> >
> > It's almost a standard across the industry to use spaces. But hey, if
> > you wanna take away my choice to use spaces whenever I work on your code
> > down the very long line, that's fine. I'm just gonna use my JOE editor
> > to fix them and purify any mixed tab/space indentation. If your editor
> > can't do that then you should get a better editor ;)
> >
> > Cheers,
> > Rob.
>
> I use tab's in all my code, and replace them with spaces when
> posting/mailing for legibility.
>
> couldn't imagine ever hitting space 4/8/12/16+ times to write a line of
> code when i can just tab/shit+tab to indent.

I use spaces for indentation but never hit the space bar. my editor
converts my tab hits to the configured number of spaces, that's it.

greets,
Zoltán Németh

>

attached mail follows:


2008. 02. 28, csütörtök keltezéssel 22.42-kor Robert Cummings ezt írta:
> On Thu, 2008-02-28 at 23:52 +0000, Nathan Rixham wrote:
> > Robert Cummings wrote:
> > > On Thu, 2008-02-28 at 20:43 +0000, Nathan Rixham wrote:
> > >> [snip]
> > >> Eric Butera wrote:
> > >>> I can hit tab and shift/tab too and it puts in spaces for me.
> > >> [snip]
> > >> Robert Cummings wrote:
> > >> > Uhhhm, I hit the tab button also and it does the right thing (namely
> > >> > inserts 4 spaces). Also, when I hit enter it auto tabs.
> > >> [snip]
> > >>
> > >> *kicks zend studio* [and nano and textpad and dreamweaver] :(
> > >>
> > >> what ide's editor's do you two use? zend's use of javaw is killing my
> > >> win2k3 dev machine anyways.
> > >
> > > I don't use an IDE. I use JOE. It's a terminal based editor. Works the
> > > same whether I'm local or remote. The nice thing about linux is how easy
> > > it is to make things work the way you want. My browser source viewer
> > > links to a PHP wrapper script that pops up a gnome-terminal with the
> > > specification to load the JOE editor on the page source. My default
> > > editor in linux is JOE. It just works. Plain, simple, 100% keyboard,
> > > keystroke macros, etc, etc. I love it. You probably won't :)
> >
> > couldn't be further from the truth! sounds perfect - I spend most of my
> > life in putty anyways, generally using nano to "type".
>
> I did say probably... you may be the only one ;)
>
> > When
> > > working I click an icon on my taskbar, it opens three terminals in my
> > > favourite layout. I usually use one to edit HTML, one to edit whatever
> > > module I'm working on, and another for whatever else needs to be done
> > > (CVS commits, CVS updates, SSH, etc).
> >
> > see I've only recently started using versioning software all the time,
> > I'm currenly svn'ing, how does CVS weight up against it?
>
> I need to look into SVN. I've been meaning to take a look at it for over
> a year now but the motivation isn't terribly strong since CVS does
> everything I need and I have a lot of stuff in CVS. The main problem
> with CVS I see is that it can be pig-assed slow when updating. Also it
> has deficiencies when handling directories. I imagine whenever I get
> around to taking a look at SVN I'll also have a poke at GIT.

I strongly recommend git. it has several great advantages above cvs or
svn. for example, it does not store whole copies of the whole tree if
you make a branch, but stores only the differences. it is much faster,
and losing a commit is really hard even if you screw things up seriously
(I know I've done that a couple of times when I was new to git, but I
could manage to restore everything)

greets,
Zoltán Németh

>