Page 1 of 1

C style blocks

Posted: Wed Sep 01, 2004 11:27 pm
by anjanesh
Is there any way to have the C style blocks ?

Code: Select all

<?php
 {
 	$a=5;
 	echo $a;
 }
echo $a;
?>
The output of this
55
instead I want it to be
5
Notice: Undefined variable: a in xxx.php on line xx

I want this to free some memory after usage in a block.

Posted: Thu Sep 02, 2004 12:40 am
by feyd
use unset on all variables created in the block.

Posted: Thu Sep 02, 2004 1:00 am
by anjanesh
Yes. Thats one method but its manual and for many variables its extra work. C style blocks make it so much easier.

Posted: Thu Sep 02, 2004 1:11 am
by feyd
yeah.. too bad they don't exist in PHP. boo hoo. :cry: :? (outside of functions)