php-general Digest 25 Aug 2009 07:55:41 -0000 Issue 6304

Topics (messages 297141 through 297167):

Re: unset( $anobject) does not invoce __destruct()
        297141 by: Ralph Deffke
        297142 by: Ralph Deffke
        297147 by: hack988 hack988
        297153 by: Lupus Michaelis
        297158 by: Ralph Deffke

php move_uploaded_file() filesize problem
        297143 by: Thomas Gabrielsen
        297149 by: Ryan Cavicchioni
        297150 by: Ryan Cavicchioni
        297152 by: Thomas Gabrielsen
        297154 by: Ralph Deffke

Re: What if this code is right ? It worked perfectly for years!!
        297144 by: Paul M Foster
        297145 by: Lars Torben Wilson

Re: preg_replace anything that isn't WORD
        297146 by: hack988 hack988
        297164 by: Shawn McKenzie
        297165 by: Jonathan Tapicer

unset() something that doesn't exist
        297148 by: Tom Worster
        297156 by: Ralph Deffke
        297162 by: Shawn McKenzie
        297163 by: Shawn McKenzie

Re: PHP pages won't open correctly on my server.
        297151 by: RRT

DOMNode children iteration (was Re: array() returns something weird)
        297155 by: Szczepan Hołyszewski

__destruct() not called ! we shot us in the foot try the script
        297157 by: Ralph Deffke
        297159 by: Jim Lucas

Re: Is there limitation for switch case: argument's value?
        297160 by: Keith

Re: PHP Shopping Cart Recommendation
        297161 by: sono-io.fannullone.us

security question of ZCE exam
        297166 by: Augusto Flavio

anchor inside form
        297167 by: leledumbo

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 ---
I dont agree, and as u see in my snipped code it works fine.

in an abstract class u can define an implementation to define some basic
things a overwriting function in an extending class has to take care of as
well.

this includes specialy magic functions.

thats what they are made for. may be you talk about interfaces ?

"hack988 hack988" <hack...@dev.htwap.com> wrote in message
news:4d03254c0908241122r5b6d1c3csc06ec475a0797...@mail.gmail.com...
> see http://cn.php.net/manual/en/language.oop5.abstract.php
> PHP 5 introduces abstract classes and methods. It is not allowed to
> create an instance of a class that has been defined as abstract. Any
> class that contains at least one abstract method must also be
> abstract. Methods defined as abstract simply declare the method's
> signature they cannot define the implementation.
>
> You make misconception understand for abstract class,:(, correct code is:
> abstract class a {
>    abstract public function __construct(){
>
>   }
>   abstract public function __destruct(){
>
>   }
>  }
>
>  class b extends a{
>    public function __construct(){
>     echo "constructing....<br>";
>   }
>   public function __destruct(){
>     echo "destructing....<br>";
>   }
>  }
>
>  $c = new b();
> unset($c);
>
> if you want to make it work correctly that you want,plase change code to
follow
> class c {
>    public function __construct(){
>     echo "constructing....<br/>";
>   }
>   public function __destruct(){
>     echo "destructing....<br/>";
>   }
> }
>
>  class d extends c{
>
>  }
>   $e = new d();
>   unset($e);



--- End Message ---
--- Begin Message ---
Stuart, u are right, the refcount in php 5 doesn't matter, where something
left behind in my memory from earlier days, However i do have the effect
that unsetting an object does NOT call __dectruct() ! but when the script
ends it is called. this can be easily tested by putting a echo in destruct.

my objects affected are pretty much the sheme I send. however I'm doing some
reflection stuff in my classes. may be thats the reason. I will do some
further investigation about that.


"Stuart" <stut...@gmail.com> wrote in message
news:a5f019de0908240749l8fa749s825cfa0e475f7...@mail.gmail.com...
2009/8/24 Ralph Deffke <ralph_def...@yahoo.de>:
> this is also not the full truth try this and it works
> what are the circumstances that is causing this problem then, yes I do
have
> distributed references over my script and there are clearly references
still
> set, however after running the snipped script I can not see what I do
> special in my script causing the problem. I even tried with public and
> private static in other objects. it works. however the manual indicates
the
> refernce counter has to be 0.

Assuming you're using PHP 5...

> <?php
>
>
> abstract class a {
> public function __construct(){
> echo "constructing....<br>";
> }
> public function __destruct(){
> echo "destructing....<br>";
> }
> }
>
> class b extends a{
>
> }
>
> $c = new b();

refcount = 1

> $d = $c ; // works

refcount = 2

> $f[] = $c ; // works

refcount = 3

> class e {
> private $m;
>
> public function setM( $m ){
> $this->m = $m;
> }
> }
>
> $o = new e();
> $o->setM( $c ); // works

refcount = 4 (due to assignment in setM)

> unset( $c );

refcount = 3

In PHP 5 all objects are passed by reference unless explicitly cloned.
This means that assigning an object variable to another variable does
nothing more than assign a reference and increment the referece count.

What exactly in the manual leads you to believe that after the unset
the refcount should be 0?

-Stuart

-- 
http://stut.net/

> "Lupus Michaelis" <mickael+...@lupusmic.org> wrote in message
> news:41.f9.03363.01192...@pb1.pair.com...
>> kranthi wrote:
>> > unset($obj) always calls the __destruct() function of the class.
>>
>> Never calls the dtor. The dtor will be called only when the reference
>> count reaches 0.
>>
>> class c { function __destruct() { echo 'dying !' ; } }
>> $v1 = new c ;
>> $v2 = $v1 ;
>>
>> unset($v1) ; // don't call the dtor
>> unset($v2) ; // call the dtor
>>
>> --
>> Mickaël Wolff aka Lupus Michaelis
>> http://lupusmic.org
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>



--- End Message ---
--- Begin Message ---
i test your codes again,it is work correctly!
But for backends compatibly with older php versions my codes is better
:),i'm sorry for my mistake at moment.

--- End Message ---
--- Begin Message ---
Ashley Sheridan wrote:

That would seem sensible to me though really. A constructor only bears
true for the base class, so any classes which inherit it must
incorporate all the constructor parts. A destructor doesn't know about
further classes which will need to inherit it, so it shouldn't be
inherited and the new class should sort things out. At least, that's how
I see it.

No, destructor can be set in abstract class. And it must if some advanced stuff done in the base classe. Like freeing ressources, closing file or database connections that is generic for classes that implements abstract stuff.

So said, the __destuct destructor isn't called, for obvious reasons explained further.

--
Mickaël Wolff aka Lupus Michaelis
http://lupusmic.org

--- End Message ---
--- Begin Message ---
I did start a new topic
have a look there;

""Ralph Deffke"" <ralph_def...@yahoo.de> wrote in message
news:79.73.03363.43752...@pb1.pair.com...
> but it should? shouldn't it how can I destroy a class instance invocing
> __detruct() of the class ?!?!?
>
>
>
>
>



--- End Message ---
--- Begin Message ---
Hi

I have a problem with uploading files that are bigger than the Master Value allow me to, which is 32 MB. I've set the max_upload_filesize and max_post_size in a .htaccess file and the phpinfo() reports the new local value (128 MB) according to the .htaccess, but the script fails silently with no errors every time I try to upload a file greater than 32 MB. Have any of you had the same problem?

Thanks!

Thomas Gabrielsen
--- End Message ---
--- Begin Message ---
On Mon, Aug 24, 2009 at 09:54:03PM +0200, Thomas Gabrielsen wrote:
> Hi
>
> I have a problem with uploading files that are bigger than the Master 
> Value allow me to, which is 32 MB. I've set the max_upload_filesize and  
> max_post_size in a .htaccess file and the phpinfo() reports the new local 
> value (128 MB) according to the .htaccess, but the script fails silently  
> with no errors every time I try to upload a file greater than 32 MB. Have 
> any of you had the same problem?

Hello,

What is 'memory_limit' set at 

Regards,
  --Ryan Cavicchioni

--- End Message ---
--- Begin Message ---
On Mon, Aug 24, 2009 at 09:54:03PM +0200, Thomas Gabrielsen wrote:
> Hi
>
> I have a problem with uploading files that are bigger than the Master 
> Value allow me to, which is 32 MB. I've set the max_upload_filesize and  
> max_post_size in a .htaccess file and the phpinfo() reports the new local 
> value (128 MB) according to the .htaccess, but the script fails silently  
> with no errors every time I try to upload a file greater than 32 MB. Have 
> any of you had the same problem?

I stumbled across this blog post:
http://www.gen-x-design.com/archives/uploading-large-files-with-php/

He suggests also looking at the script timeout and the
'max_input_time' ini setting.

Regards,
  --Ryan Cavicchioni

--- End Message ---
--- Begin Message ---

"Ryan Cavicchioni" <ryan...@confabulator.net> wrote in message news:20090824205810.gc32...@mail.confabulator.net...
On Mon, Aug 24, 2009 at 09:54:03PM +0200, Thomas Gabrielsen wrote:
Hi

I have a problem with uploading files that are bigger than the Master
Value allow me to, which is 32 MB. I've set the max_upload_filesize and
max_post_size in a .htaccess file and the phpinfo() reports the new local
value (128 MB) according to the .htaccess, but the script fails silently
with no errors every time I try to upload a file greater than 32 MB. Have
any of you had the same problem?

I stumbled across this blog post:
http://www.gen-x-design.com/archives/uploading-large-files-with-php/

He suggests also looking at the script timeout and the
'max_input_time' ini setting.

Regards,
 --Ryan Cavicchioni

Hi Ryan, and thanks for your reply:

I've allready set that, but I forgot to mention it in the first post. This is what my .htaccess looks like:
php_value upload_max_filesize 64M
php_value max_execution_time 800
php_value post_max_size 64M
php_value max_input_time 100
php_value memory_limit 120M

I'm very sure that it has something to do with the upload_max_filesize because I generated two files, one just a little greater than 32MB, and one just a little bit smaller. The latter file is uploaded fine, but the bigger one is not.

Thanks!
Thomas Gabrielsen
--- End Message ---
--- Begin Message ---
I would also be shure that u run into the srcipt time out time. of course
there is one limit u can be a little bit under or a little bit above.

measure the time with microtime() and compare it with the script time out
settings and u will have the answer

ralph_def...@yahoo.de

""Thomas Gabrielsen"" <tho...@arton.no> wrote in message
news:df.aa.03363.30213...@pb1.pair.com...
>
> "Ryan Cavicchioni" <ryan...@confabulator.net> wrote in message
> news:20090824205810.gc32...@mail.confabulator.net...
> > On Mon, Aug 24, 2009 at 09:54:03PM +0200, Thomas Gabrielsen wrote:
> >> Hi
> >>
> >> I have a problem with uploading files that are bigger than the Master
> >> Value allow me to, which is 32 MB. I've set the max_upload_filesize and
> >> max_post_size in a .htaccess file and the phpinfo() reports the new
local
> >> value (128 MB) according to the .htaccess, but the script fails
silently
> >> with no errors every time I try to upload a file greater than 32 MB.
Have
> >> any of you had the same problem?
> >
> > I stumbled across this blog post:
> > http://www.gen-x-design.com/archives/uploading-large-files-with-php/
> >
> > He suggests also looking at the script timeout and the
> > 'max_input_time' ini setting.
> >
> > Regards,
> >  --Ryan Cavicchioni
>
> Hi Ryan, and thanks for your reply:
>
> I've allready set that, but I forgot to mention it in the first post. This
> is what my .htaccess looks like:
> php_value upload_max_filesize 64M
> php_value max_execution_time 800
> php_value post_max_size 64M
> php_value max_input_time 100
> php_value memory_limit 120M
>
> I'm very sure that it has something to do with the upload_max_filesize
> because I generated two files, one just a little greater than 32MB, and
one
> just a little bit smaller. The latter file is uploaded fine, but the
bigger
> one is not.
>
> Thanks!
> Thomas Gabrielsen
>



--- End Message ---
--- Begin Message ---
On Mon, Aug 24, 2009 at 10:37:11AM -0700, Chris Carter wrote:

> 
> Is there any alternative method to do this !!! Sending email through PHP?
> 

Sure. You can use a class like PHPMailer rather than the built-in mail()
function. But it's not going to matter if the problem is at the mail
server, etc.

Paul

-- 
Paul M. Foster

--- End Message ---
--- Begin Message ---
2009/8/24 Paul M Foster <pa...@quillandmouse.com>:
> On Mon, Aug 24, 2009 at 10:37:11AM -0700, Chris Carter wrote:
>
>>
>> Is there any alternative method to do this !!! Sending email through PHP?
>>
>
> Sure. You can use a class like PHPMailer rather than the built-in mail()
> function. But it's not going to matter if the problem is at the mail
> server, etc.
>
> Paul

Agreed. Rather than just trying things willy-nilly, the OP should
attempt to determine what the actual problem is. This gives a much
greater chance of solving it.


Torben

--- End Message ---
--- Begin Message ---
 Use preg_replace_callback instead!
preg_replace_callback is better performance than preg_replace with /e.
---------------------------------------------------------------------------------
code

$str="cats i  saw a cat and a dog";
$str1=preg_replace_callback("/(dog|cat|.)/is","call_replace",$str);
echo $str."<BR/>";
echo $str1;
function call_replace($match){
 if(in_array($match[0],array('cat','dog')))
  return $match[0];
 else
  return "";
}

2009/8/24 tedd <tedd.sperl...@gmail.com>:
>> On Sat, Aug 22, 2009 at 12:32 PM, “•ÈýÏÝ“•ÂÔ<danondan...@gmail.com>
wrote:
>>>
>>>  Lets assume I have the string "cats i  saw a cat and a dog"
>>>  i want to strip everything except "cat" and "dog" so the result will be
>>>  "catcatdog",
>>>  using preg_replace.
>>>
>>>
>>>  I've tried something like /[^(dog|cat)]+/ but no success
>>>
>>  > What should I do?
>
> Lot's of ways to skin this cat/dog.
>
> What's wrong with exploding the string using spaces and then walking the
> array looking for cat and dog while assembling the resultant string?
>
> Cheers,
>
> tedd
>
>
> --
> -------
> http://sperling.com  http://ancientstones.com  http://earthstones.com
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

--- End Message ---
--- Begin Message ---
hack988 hack988 wrote:
>  Use preg_replace_callback instead!
> preg_replace_callback is better performance than preg_replace with /e.
> ---------------------------------------------------------------------------------
> code
> 
> $str="cats i  saw a cat and a dog";
> $str1=preg_replace_callback("/(dog|cat|.)/is","call_replace",$str);
> echo $str."<BR/>";
> echo $str1;
> function call_replace($match){
>  if(in_array($match[0],array('cat','dog')))
>   return $match[0];
>  else
>   return "";
> }
> 
> 2009/8/24 tedd <tedd.sperl...@gmail.com>:
>>> On Sat, Aug 22, 2009 at 12:32 PM, “•ÈýÏÝ“•ÂÔ<danondan...@gmail.com>
> wrote:
>>>>  Lets assume I have the string "cats i  saw a cat and a dog"
>>>>  i want to strip everything except "cat" and "dog" so the result will be
>>>>  "catcatdog",
>>>>  using preg_replace.
>>>>
>>>>
>>>>  I've tried something like /[^(dog|cat)]+/ but no success
>>>>
>>>  > What should I do?
>> Lot's of ways to skin this cat/dog.
>>
>> What's wrong with exploding the string using spaces and then walking the
>> array looking for cat and dog while assembling the resultant string?
>>
>> Cheers,
>>
>> tedd
>>
>>
>> --
>> -------
>> http://sperling.com  http://ancientstones.com  http://earthstones.com
>>
>> --
>> PHP General Mailing List (http://www.php.net/)
>> To unsubscribe, visit: http://www.php.net/unsub.php
>>
>>
> 
Certain posts of mine seem to get sucked into a black hole and I never
see theme.  Maybe because I use this list as a newsgroup?  Anyway, what
I posted before:

Match everything but only replace the backreference for the words:


$s = "cats i  saw a cat and a dog";
$r = preg_replace('#.*?(cat|dog).*?#', '\1', $s);

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

--- End Message ---
--- Begin Message ---
For the record Shawn: I received your previous post from Aug 22 and I
think that it is the best solution.

Jonathan

On Tue, Aug 25, 2009 at 12:41 AM, Shawn McKenzie<nos...@mckenzies.net> wrote:
> hack988 hack988 wrote:
>>  Use preg_replace_callback instead!
>> preg_replace_callback is better performance than preg_replace with /e.
>> ---------------------------------------------------------------------------------
>> code
>>
>> $str="cats i  saw a cat and a dog";
>> $str1=preg_replace_callback("/(dog|cat|.)/is","call_replace",$str);
>> echo $str."<BR/>";
>> echo $str1;
>> function call_replace($match){
>>  if(in_array($match[0],array('cat','dog')))
>>   return $match[0];
>>  else
>>   return "";
>> }
>>
>> 2009/8/24 tedd <tedd.sperl...@gmail.com>:
>>>> On Sat, Aug 22, 2009 at 12:32 PM, “•ÈýÏÝ“•ÂÔ<danondan...@gmail.com>
>> wrote:
>>>>>  Lets assume I have the string "cats i  saw a cat and a dog"
>>>>>  i want to strip everything except "cat" and "dog" so the result will be
>>>>>  "catcatdog",
>>>>>  using preg_replace.
>>>>>
>>>>>
>>>>>  I've tried something like /[^(dog|cat)]+/ but no success
>>>>>
>>>>  > What should I do?
>>> Lot's of ways to skin this cat/dog.
>>>
>>> What's wrong with exploding the string using spaces and then walking the
>>> array looking for cat and dog while assembling the resultant string?
>>>
>>> Cheers,
>>>
>>> tedd
>>>
>>>
>>> --
>>> -------
>>> http://sperling.com  http://ancientstones.com  http://earthstones.com
>>>
>>> --
>>> PHP General Mailing List (http://www.php.net/)
>>> To unsubscribe, visit: http://www.php.net/unsub.php
>>>
>>>
>>
> Certain posts of mine seem to get sucked into a black hole and I never
> see theme.  Maybe because I use this list as a newsgroup?  Anyway, what
> I posted before:
>
> Match everything but only replace the backreference for the words:
>
>
> $s = "cats i  saw a cat and a dog";
> $r = preg_replace('#.*?(cat|dog).*?#', '\1', $s);
>
> --
> Thanks!
> -Shawn
> http://www.spidean.com
>

--- End Message ---
--- Begin Message ---
is it the case that unset() does not trigger an error or throw an exception
if it's argument was never set?



--- End Message ---
--- Begin Message ---
causes an error
Parse error: parse error, expecting `T_STRING' or `T_VARIABLE' or `'$'' in
C:\wamp\www\TinyCreator\testCrapp6.php on line 42

"Tom Worster" <f...@thefsb.org> wrote in message
news:c6b87877.11463%...@thefsb.org...
> is it the case that unset() does not trigger an error or throw an
exception
> if it's argument was never set?
>
>



--- End Message ---
--- Begin Message ---
Ralph Deffke wrote:
> causes an error
> Parse error: parse error, expecting `T_STRING' or `T_VARIABLE' or `'$'' in
> C:\wamp\www\TinyCreator\testCrapp6.php on line 42
> 
> "Tom Worster" <f...@thefsb.org> wrote in message
> news:c6b87877.11463%...@thefsb.org...
>> is it the case that unset() does not trigger an error or throw an
> exception
>> if it's argument was never set?
>>
>>
> 
> 

What!?!?


No, It does not cause an error, not even a notice.

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

--- End Message ---
--- Begin Message ---
Ralph Deffke wrote:
> causes an error
> Parse error: parse error, expecting `T_STRING' or `T_VARIABLE' or `'$'' in
> C:\wamp\www\TinyCreator\testCrapp6.php on line 42
> 
> "Tom Worster" <f...@thefsb.org> wrote in message
> news:c6b87877.11463%...@thefsb.org...
>> is it the case that unset() does not trigger an error or throw an
> exception
>> if it's argument was never set?
>>
>>
> 
> 

What!?!?


No, It does not cause an error, not even a notice.

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

--- End Message ---
--- Begin Message ---
That link won't load for me.  Did you get it to load OK for you?


"Ryan Cavicchioni" <r...@confabulator.net> wrote in message 
news:20090824192749.ga13...@mail.confabulator.net...
> On Mon, Aug 24, 2009 at 01:30:00PM -0500, RRT wrote:
>> PHP pages won't open at all on my server.  HTML pages open fine, but when
>> going to the PHP pages that are on my server, the browser tries to 
>> download
>> the page like a file instead of presenting it by the browser.  What can I 
>> do
>> to make the PHP processor to be handled properly?  Do I need to recompile 
>> it
>> again, and if so, what switches should I use?
>>
>> I am running Apache version 2.2.11.  I'm on Fedora 2.6.11-1.1369_FC4 on 
>> that
>> particular server.  I'm running PHP 5.2.9 which I downloaded directly 
>> from
>> the php web site, then untarred, ran make, and make install commands as
>> described in the php INSTALL file that was included with the 
>> distribution..
>
> Hello,
>
> If PHP is installed properly, look at step 14 (loading the module in
> apache) and step 15 (Tell Apache to parse certain extensions as PHP)
> in the PHP installation documentation.
>
> http://www.php.net/manual/en/install.unix.apache2.php
>
> Regards,
>
>  -- Ryan Cavicchioni 



--- End Message ---
--- Begin Message ---
Hi Lars and list!

New facts about the strange bug initially diagnosed as array() returning NULL:

Firstly, the issue is not really about array() returning null, but about full 
blown UndefinedBehavior(TM) progressively trashing local variables. It just so 
happened that I noticed it first with a variable to which array() had been 
assigned just before things began breaking.

Secondly, I proudly present the culprit: things break when I iterate over a 
DOMNode's children *by reference* using firstChild and nextSibling:

        for($child=&$node->firstChild; $child; $child=&$child->nextSibling) {

                //processing...
        }

No problems if iteration is done by value or by DOMNodeList (childNodes, 
DOMXPath...).

HOWEVER,

I still consider this a bug because it destablizes PHP. After the evil loop 
has finished, things happen that should never happen, like a variable being 
NULL immediately after being assigned array().

I attach a demonstration. It is a self-contained commented script that you can 
execute from command line. Also attached is output on my machine.

Best regards,
Szczepan Hołyszewski

<<attachment: testme.php>>

THE GOOD WAY (DOMNodeList):

Recursion structure:

->render()
->render()
->render()
<-
->render()
<-
<-
<-

Transformation result:

    Some text.
    [object type='foo' name='bar'][param name='__default_content']
        Some parameter text.
        Some parameter text.
        [object type='bar' name='nested'][param name='__default_content']
            Some nested parameter text.
            Some nested parameter text.
            [object type='baz' name='deeply_nested'][param 
name='__default_content']
            [/param][param name='bold']true[/param][/object]
            More nested parameter text
            More nested parameter text
        [/param][/object]
    [/param][/object]
    Some more text    

Success!

THE MIXED WAY (DOMNodeList at outermost level, then firstChild/nextSibling by 
ref):

Recursion structure:

->render()
->render()
->render()
<-
->render()
<-
<-
<-

Transformation result:

    Some text.
    [object type='foo' name='bar'][param name='__default_content']
        Some parameter text.
        Some parameter text.
        __default_content[param 
name='__default_content']__default_content[/param][/object]
    [/param][/object]
    Some more text    

Is it really a success?

THE EVIL WAY (firstChild/nextSibling by ref):

Recursion structure:

->render()
->render()
->render()
<-
->render()
<-

--- End Message ---
--- Begin Message ---
well I would call this an error in the first view , and some of u where
right! and the stuff with the refernce counter seems to be right as well.

however I can't see a reason for it as 5.x works through refernces. so
unsetting a REFERENCE to the object does not destroy it.

How to destroy the object then?

<?php


abstract class a {
  public function __construct(){
    echo "constructing....<br>";
  }
  public function __destruct(){
    echo "destructing....<br>";
  }
}

class b extends a{

  public function doSomething(){
    echo "I'm doing ...but the reference c to the object is unset()<br>";
  }

}

$c = new b();

$d = $c ;   // works
$f[] = $c ; // works

class e {
  public static $m;

  public static function setM( $m ){
    self::$m = $m;
  }
}

$o = new e();
e::setM( $c ); // works

echo "unsetting ...<br>";
unset( $c );

$d->doSomething();

echo "script ending now ...<br>";

?>




--- End Message ---
--- Begin Message ---
Ralph Deffke wrote:


Sorry to bring it to this thread, but could you respond to Ashley in the
"[PHP] wierd behavior on parsing css with no php included" thread.

We would like the solution place in the archives to future visitor benefit.

Thanks

Jim


--- End Message ---
--- Begin Message ---
Oh I see. I missed out one thing too.
There is no need to put the same code under both case 7 & 6 separately, but just under case 6 will do.
This is simpler in fact!
Thanks Tedd and Torben!
I'll fix to this style from now onwards.


"tedd" <tedd.sperl...@gmail.com> wrote in message news:p06240800c6b84328c...@[192.168.1.100]...
At 9:44 PM -0700 8/22/09, Lars Torben Wilson wrote:
Hi Keith,

Glad it works! I'm not sure how inverting the case statement helps you
minimize the code in each case. As both I and Adam showed, you can do
the same thing more efficiently (and IMHO much more readably) like
this:

switch ($sum)
{
    case 8:

       break;
    case 7:
    case 6:
       break;
    case 2:
    case 1:
       break;
    case 0:
       break;
    default:
       break;
}


Additionally, I would argue there's nothing different below other than it's even more easier to read and understand:

switch ($sum)
   {
    case 0:
    break;

    case 1:
    case 2:
    break;

    case 6:
    case 7:
    break;

    case 8:
    break;

    default:
    break;
   }

Cheers,

tedd
--
-------
http://sperling.com http://ancientstones.com http://earthstones.com


--- End Message ---
--- Begin Message ---

The only e-commerce site I've worked on was based on OSCommerce. It's
pretty good, easy to integrate new functionality into, and not too much
trouble to style up to look the way you want with CSS.

Thanks, Ash. I downloaded CRE Loaded, which is an off-shoot of osCommerce, and the latest version looks pretty nice. I'm digging in to the PHP code to see what that's like. I'm also looking at Magento. That may be more than what we need, but it's getting rave reviews.

        I can't wait to go 100% PHP on our site!

Frank

--- End Message ---
--- Begin Message ---
Hi all,



i'm discutting with my friend about this question for 30 min and i do not
agree with he. Here is the question:


Why is it important from a security perspective to never display PHP error
messages directly to the end user, yet always log them?


Answers: (choose 2)
    Error messages will contain sensitive session information
    Error messages can contain cross site scripting attacks
    Security risks involved in logging are handled by PHP
X    Error messages give the perception of insecurity to the user
X    Error messages can contain data useful to a potential attacker


My answers is marked with a X.


some clue about this?


thanks



Augusto Morais

--- End Message ---
--- Begin Message ---
If I have an anchor inside form, how can I send form using the anchor without
displaying target url? I've tried the code below but IE says that this.form
is null or empty and Firefox does nothing.

<form action="somewhere.php" method="get">
    # Pick me 
</form>
-- 
View this message in context: 
http://www.nabble.com/anchor-inside-form-tp25129981p25129981.html
Sent from the PHP - General mailing list archive at Nabble.com.


--- End Message ---

Reply via email to