Skip to main content
grammar
Source Link
miahelf
  • 399
  • 1
  • 5

I think this is what you are going for:

$html .= "<a href='{$tag_link}' title='{$tag->name} {$xyz_city}' class='{$tag->slug}'>";

The {$tag->name} part is a way to insert a function or variable into a "double quoted" string definition. In the case of {$tag->name} case it needs the {curly braces} to get the whole object->method thing to work. You can usually leave the curly braces out when you have a double quoted string and want to insert a variable like $xyx_city, but its good practice to put them in there anyway just in case the underscore or something else in the name messes up the string parsing.

I think this is what you are going for:

$html .= "<a href='{$tag_link}' title='{$tag->name} {$xyz_city}' class='{$tag->slug}'>";

The {$tag->name} part is a way to insert a function or variable into a "double quoted" string definition. In {$tag->name} case it needs the {curly braces} to get the whole object->method thing to work. You can usually leave the curly braces out when you have a double quoted string and want to insert a variable like $xyx_city, but its good practice to put them in there anyway just in case the underscore or something else in the name messes up the string parsing.

I think this is what you are going for:

$html .= "<a href='{$tag_link}' title='{$tag->name} {$xyz_city}' class='{$tag->slug}'>";

The {$tag->name} part is a way to insert a function or variable into a "double quoted" string definition. In the case of {$tag->name} it needs the {curly braces} to get the whole object->method thing to work. You can usually leave the curly braces out when you have a double quoted string and want to insert a variable like $xyx_city, but its good practice to put them in there anyway just in case the underscore or something else in the name messes up the string parsing.

Source Link
miahelf
  • 399
  • 1
  • 5

I think this is what you are going for:

$html .= "<a href='{$tag_link}' title='{$tag->name} {$xyz_city}' class='{$tag->slug}'>";

The {$tag->name} part is a way to insert a function or variable into a "double quoted" string definition. In {$tag->name} case it needs the {curly braces} to get the whole object->method thing to work. You can usually leave the curly braces out when you have a double quoted string and want to insert a variable like $xyx_city, but its good practice to put them in there anyway just in case the underscore or something else in the name messes up the string parsing.