Welcome Guest, Not a member yet? Register   Sign In
UserGuide notation
#1

Reading this page in the UG:

https://bcit-ci.github.io/CodeIgniter4/general/views.html

I note that there is a code segment which shows something I am NOT familiar with;  a variable ($data) is assigned using notation which might be an array, but I've never seen this notation:


Code:
class Page extends \CodeIgniter\Controller
{
       public function index()
       {
               $data = [
                       'page_title' => 'Your title'
               ];

               echo view('header');
               echo view('menu');
               echo view('content', $data);
               echo view('footer');
       }
}


Should this actually read:

Code:
...
$data = array('page_title' => 'Your title');
...


Or is this using a "shorthand" php array declaration?
Yes, I have looked at the PHP 7 documentation, but do not find this type of assignment for an array.
CI 3.1 Kubuntu 19.04 Apache 5.x  Mysql 5.x PHP 5.x PHP 7.x
Remember: Obfuscation is a bad thing.
Clarity is desirable over Brevity every time.
Reply


Messages In This Thread
UserGuide notation - by twpmarketing - 08-28-2016, 12:16 PM
RE: UserGuide notation - by ciadmin - 08-28-2016, 12:33 PM
RE: UserGuide notation - by twpmarketing - 08-28-2016, 01:30 PM
RE: UserGuide notation - by MackieeE - 08-31-2016, 08:12 AM



Theme © iAndrew 2016 - Forum software by © MyBB