Re: Converting Perl to PHP, testing CLI with $_POST (newbie) [message #172101 is a reply to message #172098] |
Sun, 30 January 2011 21:16 |
P E Schoen
Messages: 86 Registered: January 2011
Karma:
|
Member |
|
|
"Felix Saphir" wrote in message news:ii4fdo$1ui$02$1(at)news(dot)t-online(dot)com...
> That's virtually impossible, there shouldn't be a difference
> between using a variable and a string constant. Check your
> code for typos (e.g. you're using $dbFile and $dbfile). Are
> you sure about the value of $dbfile/$dbFile?
Ah, sorry, I just took a closer look and indeed (even in the code I posted)
I had a lower case "f". The fonts in my editor and for newsgroups do not
show much difference. That's where stronger type checking and variable
declaration are useful, and I'm also still used to Delphi which is
case-insensitive. Thanks for finding my stupid error!
> Oh, the manual is a good read in any case. Just a few
> starting points to what I was referring to:
> Variable scope:
<http://www.php.net/manual/en/language.variables.scope.php>
> Object member visibility:
<http://www.php.net/manual/en/language.oop5.visibility.php>
> Object constructors and inheritance:
<http://www.php.net/manual/en/language.oop5.decon.php>
Good points. I had read the Variable Scope and it seemed to me that a
function would see and be able to use the global variable, but apparently
not in this case within "class MyDB extends SQLite3". The public method is
default and the keyword is not needed, but certainly passing the database
filename in the function argument is much preferred, and the explicit public
declaration is better than relying on the default. However, the following is
even simpler and I don't see why I shouldn't use it:
$db = new SQLite3($dbFile);
Thanks!
Paul
|
|
|