Jump to content

JongMin

New Members
  • Posts

    7
  • Joined

  • Last visited

JongMin's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Hi, there. As far as I know, in javascript, dot is used to access to an object property. But please see the following snippet: var greeting = "Hi!"; var x = greeting.toUpperCase(); As you can see, typeof greeting is string which is primtive type and has no method or property. But how can the toUpperCase() method be used after the variable greeting? Could you explain a bit? Thanks
  2. Hi, there Please see the followng query: SELECT * FROM table AS t WHERE id='%1\$s' ORDER BY -t.time'; Could you explain what is %1\$s thing and minus sign in the ORDER BY clause? Is there a website or some kind of link that I can refer to? Thanks
  3. Hi, I need to hold a value globally which could be user ID or DB object and so on. The value must be accessible from any classes or files. In this case which design pattern would you use? Superglobals? Constants? Singleton? Static? Thanks in advance
  4. Hi there, I need to use lots of variables globally which means I should access the variables across files and classes. So I decided to use the $_SESSION['']. But the thing is that it will become like 30 variables per session. I heard that It is bad to use this session variable. Is there other ways to achieve this and is that really bad to use? What is your suggestion? Thanks in advance.
  5. Hi, Please consider the following: -------------------------------------------------------------- Cool.php -------------------------------------------------------------- <?php include_once "Common.class.php"; include_once "Test.class.php"; $common = new Common; -------------------------------------------------------------- Common.class.php -------------------------------------------------------------- <?php class Common { public blahblah; public function __construct() { blah blah } public function initSomething() { //Do something } } -------------------------------------------------------------- Test.class.php -------------------------------------------------------------- <?php class Test { public function __construct() { initSomething(); // This is the method in the Common class and I want to use it here. } } In Test.class.php I want to use the initSomething() method in the Common class and in this case how do you normally archive this? Thanks in advance.
  6. Sorry wrong question; ignore the original question and see below: *** test.class.php *** class Test { public $test1; public $test2; function getTest1() { return $this->test1 = 'Test.'; } 7 function getTest2() { $this->test2 = 'Test.'; } function getTest3() { echo 'Test.'; } } *** test.php *** <?php require_once("test.class.php"); Test = new Test(); // prints Test on the screen echo $Test->test1; // prints Test on the screen echo $Test->test2; // prints Test on the screen Test->getTest3(); Q1. What is the difference between getTest1() and getTest2()? Q2. Which one is the best way to call the function among these functions for the system performance?
  7. Hi, all Please look at the code below: *** test.class.php *** class Test { public $test1; public $test2; public $test3; function getTest1() { return $this->test1 = 'Test.'; } function getTest2() { $this->test2 = 'Test.'; } function getTest3() { echo 'Test.'; } } *** test.php *** <?php require_once("test.class.php"); Test = new Test(); // prints Test on the screen echo Test->getTest1(); // prints Test on the screen echo Test->getTest2(); // prints Test on the screen Test->getTest3(); Q1. What is the difference between getTest1() and getTest2()? Q2. Which one is the best way to call the function among these functions for the system performance? Thanks in advance
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.