Home Please Explain meaning of {} syntax for me
Reply: 1

Please Explain meaning of {} syntax for me

Steve Published in 2017-11-15 03:51:14Z

This question already has an answer here:

  • Whats the difference between {$var} and $var? 6 answers

I am a newbie and try to learn PHP especially INSERT INTO statement. I'm know that if we insert value for String we must use '' syntax. But i don't understand meaning of {} syntax for "title" and"link". Any guys can explain for me. Thanks a lot.

shubham715 Reply to 2017-11-15 03:58:38Z

On Sql side there is no difference between '$title' or '{$title}' . but in php {$title} is a more complete syntax of $title, that allows one to use :

  • "this is post {$title}s"
  • "{$object->data}"
  • "{$array['data']}"
  • "{$array['data']->obj->plop['test']}"

The curly braces "escape" the PHP variable and are not passed to MySQL. With a simple variable like $title it doesn't make a difference but with something like $post['title'] it does. for more information check this

You need to login account before you can post.

About| Privacy statement| Terms of Service| Advertising| Contact us| Help| Sitemap|
Processed in 0.313456 second(s) , Gzip On .

© 2016 Powered by mzan.com design MATCHINFO