Welcome Guest, Not a member yet? Register   Sign In
Is it correct to say function?
#1

I am new to CI and PHP. I am studying
https://codeigniter.com/user_guide/libra...onfig.html

There are two ways to load a config file:
Manual Loading
To load one of your custom config files you will use the following function within the controller that needs it:


We know when we call by object it is called a method, however the above line used the term function , Why?
Reply
#2

(This post was last modified: 02-21-2020, 07:48 PM by dave friend.)

A "method" is a "function" that belongs to a class. Though "method" would be a more precise description either term is correct.

Keep in mind that a class method is defined using the keyword "function", e.g.

PHP Code:
<?php
class SimpleClass
{
    
// method definition
    
public function displayHello() {
        echo 
"Hello World";
    }

Reply
#3

(This post was last modified: 02-27-2020, 10:49 AM by jreklund.)

(02-21-2020, 07:43 PM)dave friend Wrote: A "method" is a "function" that belongs to a class. Though "method" would be a more precise description either term is correct.

Keep in mind that a class method is defined using the keyword "function", e.g.

PHP Code:
<?php
class SimpleClass
{
    // method definition
    public function displayHello() {
        echo "Hello World";
    }


Thank you so much!
Reply




Theme © iAndrew 2016 - Forum software by © MyBB