PHP Use of undefined constant -


so i'm getting bunch of errors of undefined constants , i'm not sure why. i'm running on windows wamp server if makes difference. i'm writing code in dreamweaver cs6 , not showing errors. here code:

<!doctype html> <?php     $services = array(                 "website" => array (                     title => "web site design",                     price => "vaires contact free quote",                     blurb => "we make websites"                 ),                 "nas" => array (                     title => "nas storage",                     price => "vaires contact free quote",                     blurb =>" make make servers"                 ),                 "localserver" => array (                     title => "local sever setup",                     price => "vaires contact free quote",                     blurb => "we make make servers"                 ),  ); ?> <html> <head> <meta charset="utf-8"> <?php include 'includes/header.php'?> <title>anise technologys | services</title> </head> <body> <div class="wrapper"> <?php include 'includes/nav.php'?> <div class="content">   <h1 id="title-center">services</h1>   business technology solution offer wide range of solutions fit business's needs   <div class="list">     <?php foreach ($services $key => $item) {?>     <div class="list-left"><?php echo $item[title]; ?></div>     <div class="list-mid"><?php echo $item[blurb]; ?></div>     <div class="list-right"><a href="http://localhost/latech/service?item=<?php echo $key; ?>">more</a></div>     <hr>     <?php } ?>   </div> </div> </div> </body> </html> 

the key values arrays strings, , should quoted such

$services = array(             "website" => array (                 'title' => "web site design",                 'price' => "vaires contact free quote",                 'blurb' => "we make websites"             ),             "nas" => array (                 'title' => "nas storage",                 'price' => "vaires contact free quote",                 'blurb' =>" make make servers"             ),             "localserver" => array (                 'title' => "local sever setup",                 'price' => "vaires contact free quote",                 'blurb' => "we make make servers"             ), ); 

an unquoted string value perceived constant php, check if constant name exists, , substitute value if does.

if no constant of name exists, (generously) assume meant use quoted string instead, , treat such; issue notice let know should fix it.

note there performance overhead in both checking constants list, , in issuing notice, it's benefit fix it

note same applies when you're referencing array in code, so

<div class="list-left"><?php echo $item[title]; ?></div> <div class="list-mid"><?php echo $item[blurb]; ?></div> 

should

<div class="list-left"><?php echo $item['title']; ?></div> <div class="list-mid"><?php echo $item['blurb']; ?></div> 

Comments

Popular posts from this blog

google chrome - Developer tools - How to inspect the elements which are added momentarily (by JQuery)? -

angularjs - Showing an empty as first option in select tag -

php - Cloud9 cloud IDE and CakePHP -