FUDforum
Fast Uncompromising Discussions. FUDforum will get your users talking.

Home » Imported messages » comp.lang.php » Converting Perl to PHP, testing CLI with $_POST (newbie)
Show: Today's Messages :: Polls :: Message Navigator
Return to the default flat view Create a new topic Submit Reply
Re: Converting Perl to PHP, testing CLI with $_POST (newbie) [message #172101 is a reply to message #172098] Sun, 30 January 2011 21:16 Go to previous messageGo to previous message
P E Schoen is currently offline  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
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: passing variable to a nested array
Next Topic: Stats comp.lang.php (last 7 days)
Goto Forum:
  

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ]

Current Time: Wed Nov 27 12:06:27 GMT 2024

Total time taken to generate the page: 0.04640 seconds