On Thu, Jul 16, 2009 at 9:53 AM, Govinda wrote:
>
> On Jul 15, 2009, at 3:28 PM, tedd wrote:
>
>> My way -- every time I open a database, I do so by including the
>> configuration.php file that holds the logon/password et other data to
>> connect with the database. When I'm done with what I want fr
On Jul 15, 2009, at 3:28 PM, tedd wrote:
My way -- every time I open a database, I do so by including the
configuration.php file that holds the logon/password et other data
to connect with the database. When I'm done with what I want from
the database, I close it.
If one does not close i
At 12:21 PM +0200 7/14/09, Anton Heuschen wrote:
In my index.php page I then use $dbconnect again but do I simply use
$dbconnect again ... or must I say global $dbconnect and then use it in the
rest of the DB calls? or use GLOBALS ..
Anton:
My way -- every time I open a database, I do so
do you need to use global?
IMO you should use just 1 global variable, thats is what I call "entry point"
My scripts looks like...
require_once 'loader.php';
Loader::registerAutoload();
$foo = new Foo();
$foo->doStuff();
This way you can develop faster and do maintenance better avoiding
problems
> Oh and if one class uses methods in another class do I instansiate a
> new object of the other class I have seen use of OtherClass::Method
> is this better method of $obj = new OtherClass() use
The :: is used to access static methods of a class. Static methods can
be used withou
On Tue, Jul 14, 2009 at 6:21 AM, Anton Heuschen wrote:
> This is just a general question,
>
> I am not 100% on when to use global $var , and $this->var and how/what
> about the GLOBAL vars
>
> Lets say I have one file I call config.php here I connect to the db, to
> ldap etc the con
This is just a general question,
I am not 100% on when to use global $var , and $this->var and how/what
about the GLOBAL vars
Lets say I have one file I call config.php here I connect to the db, to
ldap etc the connection "var" I can then use in a file on its own ...
obviously aft
Hello again guys,
I was wondering the best way to tackle the following problem:
I've got a class, containing a property which is another object. So from
outside I should be able to do
$firstobject->propertycontainingobject->methodinsidethatobject();
The $firstobject variable is in the global nam
Define a class function and pass the array via this function or pass it
via the classes constructor.
VamVan wrote:
Hello Guys,
I have a problem here. I hope you can help me resolving it.
Please see the code below
array.php has $array1 = ('hello'=>'heelo',)
require_once('array.php');
class
VamVan wrote:
Hello Guys,
I have a problem here. I hope you can help me resolving it.
Please see the code below
array.php has $array1 = ('hello'=>'heelo',)
require_once('array.php');
class Classa {
}
How can I access the array values in my class? I want to understand the
scope.
You can't
Hello Guys,
I have a problem here. I hope you can help me resolving it.
Please see the code below
array.php has $array1 = ('hello'=>'heelo',)
require_once('array.php');
class Classa {
}
How can I access the array values in my class? I want to understand the
scope.
Thanks
On Wed, April 18, 2007 5:33 pm, Yvan Strahm wrote:
> I have this function:
>
> function preg_array($pattern, $array, $r_array)
> {
> global $match;
> global $r_array;
Passing in $r_array *AND* declaring it global is just plain silly.
Do one or the other, but not both.
If the array is L
Hi all,
I have this code ( but you already know it ;-) :
function preg_array($pattern, $array, $r_array)
{
global $match;
global $r_array;
foreach ($array as $key => $value)
{
if (preg_match($pattern, $value,$match))
{
$r_array=array_slice($match,1);
break;
hi all,
I have this function:
function preg_array($pattern, $array, $r_array)
{
global $match;
global $r_array;
foreach ($array as $key => $value)
{
if (preg_match($pattern, $value,$match))
{
$GA=array_slice($match,1);
break;
}
}
return array ($GA,
$foo = 'foo';
Then it's scope is the function including the file.
It's important to have this clear in your head when dealing with
included files, so I wrote an example that will hopefully demonstrate it
for the OP...
http://dev.stut.net/php/scope/
-Stut
--
On Thu, 2007-01-18 at 10:29 -0500, tedd wrote:
> At 9:49 PM -0800 1/17/07, jekillen wrote:
> >Hello php list:
> >If I include a php script inside a php function definition and then call the
> >function in another script. What is the scope of variables in the included
> >script? Are they local to th
At 9:49 PM -0800 1/17/07, jekillen wrote:
Hello php list:
If I include a php script inside a php function definition and then call the
function in another script. What is the scope of variables in the included
script? Are they local to the function that calls include with the file name?
Thanks in
# [EMAIL PROTECTED] / 2007-01-17 21:49:05 -0800:
> Hello php list:
> If I include a php script inside a php function definition and then
> call the function in another script. What is the scope of variables in
> the included script? Are they local to the function that calls include
> with the file
On 1/17/07, Andrew Kreps <[EMAIL PROTECTED]> wrote:
On 1/17/07, jekillen <[EMAIL PROTECTED]> wrote:
> Hello php list:
> If I include a php script inside a php function definition and then
> call the
> function in another script. What is the scope of variables in the
> included
> script? Are they
On 1/17/07, jekillen <[EMAIL PROTECTED]> wrote:
Hello php list:
If I include a php script inside a php function definition and then
call the
function in another script. What is the scope of variables in the
included
script? Are they local to the function that calls include with the file
name?
Tha
Hello php list:
If I include a php script inside a php function definition and then
call the
function in another script. What is the scope of variables in the
included
script? Are they local to the function that calls include with the file
name?
Thanks in advance;
I'm not sure where to look fo
Stuart Bailey wrote:
Hi
I'm developing an app to administer LDAP (phpLdapAdmin is too complex for the
customer).
I have created an LDAP class, in a file class_ldap.php. It include methods for
connecting to the server, binding a DN (effectively login), and adding posix
groups.
I have an index
Hi
I'm developing an app to administer LDAP (phpLdapAdmin is too complex for the
customer).
I have created an LDAP class, in a file class_ldap.php. It include methods for
connecting to the server, binding a DN (effectively login), and adding posix
groups.
I have an index.php with include_once '
GH wrote:
> Hi I am having an issue with I think it is the scope of variables:
>
> I have a file that I am including which has the following"
>
> // +--
> // | PHP Source
> // +-
> In my main file, I am attempting to from with in a function
> call $language['project_name'] and i am failing... can you
> offer any advice?
>
Are there any specific reasons that you need to set the variable to global
scope?
It's typically recommended that unless you need to, to pass the va
Hi I am having an issue with I think it is the scope of variables:
I have a file that I am including which has the following"
";
global $langauge;
$language['project_name'] = "P.L.I.M.S";
$language['sub_project_name'] = "DCR CC";
?>
In my main file, I am attempting to from with in a function ca
List
Subject: Re: [PHP] scope problem
Hello Larry,
Friday, March 5, 2004, 4:01:39 PM, you wrote:
LB> This gives values something to the tune of...
LB> 200
LB> 400
LB> 700
LB> 100
Hard to say with so little code, but...
Your first where loop is probably running twice, i.e. res
Hello Larry,
Friday, March 5, 2004, 4:01:39 PM, you wrote:
LB> This gives values something to the tune of...
LB> 200
LB> 400
LB> 700
LB> 100
Hard to say with so little code, but...
Your first where loop is probably running twice, i.e. resetting
variable back to 100 after the 2nd (internal) wh
Apparently I'm having some kind of meltdown here. Can anyone explain the
logic behind why the following variable has the original value and how I can
pull/push the value to access it at the end?
while loop
{
$variable = 100;
while loop
{
switch($othervar)
I checked the manual but I still don't get it.
http://us2.php.net/manual/en/language.variables.scope.php
I'm setting a variable $pics with a form by post method. It's on a
"screen" that is included, then it needs to be applied to another
"screen" that will take it's place when it's all re-process
If anyone read this post, you probably already forgot about it, but I
just wanted to clarify that I found the source of the problem and it was
a coding mistake on my part, not a problem with PHP's array
implementation.
Erik
On Thursday, June 6, 2002, at 03:11 PM, Erik Price wrote:
> Hi
Hi all,
a quick question about using PHP's objects, specifically in terms of the
scope of class attributes:
Normally, in PHP, a variable in a function is local to that function and
is NOT a reference to a similarly-named variable outside the function,
right? To the best of my knowledge, ther
Whoops, you're right. Classic 'C' mistake using = instead of ==. Never mind
:(
> On Mon, 2002-03-11 at 18:51, Randall Perry wrote:
>> According to the PHP 4 docs all variables are global unless within a
>> function. I've got the following test code which should output 2, but
>> outputs 1. The whi
rch 11, 2002 6:52 PM
To: [EMAIL PROTECTED]
Subject: [PHP] Scope problem in while loop
According to the PHP 4 docs all variables are global unless within a
function. I've got the following test code which should output 2, but
outputs 1. The while loop creates it's own class object (w
On Mon, 2002-03-11 at 18:51, Randall Perry wrote:
> According to the PHP 4 docs all variables are global unless within a
> function. I've got the following test code which should output 2, but
> outputs 1. The while loop creates it's own class object (which seems strange
> since it isn't explicitl
According to the PHP 4 docs all variables are global unless within a
function. I've got the following test code which should output 2, but
outputs 1. The while loop creates it's own class object (which seems strange
since it isn't explicitly instantiated by my code; I would think it would
cause er
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1
Hi,
I have the solution to my problem here but can't see why i need it?
this snippet takes $AuthId from a form and but does not work (doesn't
seem to pass it to the function)
case "edit":
$tips->get_author($AuthId);
$content
On Friday 16 February 2001 04:19, Maxim Maletsky wrote:
> It will escape the error ... or better say you force the function to
> always return true.
[...]
> $where = @where($user);
>
> this will always return true no matter what happen
Bullshit (sorry. I just *had* to say this :). From the manual
come from, am I
right ?
so you use :
$where = @where($user);
this will always return true no matter what happen
Cheers,
Maxim Maletsky
-Original Message-
From: Karl J. Stubsjoen [mailto:[EMAIL PROTECTED]]
Sent: Thursday, February 15, 2001 1:37 AM
To: PHP Mailing List
Subject: [PH
On Wednesday 14 February 2001 17:36, Karl J. Stubsjoen wrote:
> When you @ "at" a command (supress error messaging) within a function,
> is the scope of the @ within the function?
>
> Example:
>
>
> CloseODBC(1);
>
> # is error message supressed here too?
>
>
> function CloseODBC($connection_id)
>
My understanding is, it simple supress the any messages generated from
the result. So I guess it is local.
Karl J. Stubsjoen wrote:
> When you @ "at" a command (supress error messaging) within a function, is
> the scope of the @ within the function?
>
> Example:
>
>
> CloseODBC(1);
>
> # is
When you @ "at" a command (supress error messaging) within a function, is
the scope of the @ within the function?
Example:
CloseODBC(1);
# is error message supressed here too?
function CloseODBC($connection_id)
{
# error messaging supressed
@odbc_close($connection_id);
}
--
PHP G
42 matches
Mail list logo