Answers for "how to combine variables and text into a string php"

PHP
2

how to combine variables and text into a string php

<?php
$number = 8;
$txt = "the number is".$number.", ok?"; //Use a dot to combine
echo $txt;
?>
Posted by: Guest on November-01-2020
7

php concat

$a = "hello";
$b = "world";
$c = $a . " " . $b;

echo $c; // hello world
Posted by: Guest on February-24-2020
1

add more data to variable php

$a = "Hello ";
$a .= "World!";
Posted by: Guest on August-20-2020
2

how to add two string in php

Remember dot .
Posted by: Guest on August-23-2020
0

php concat variable and string

<?php
  $name = "Paul";	
  $age = 26;

  echo "My name is {$name}, I'm {$age} years old ";
Posted by: Guest on March-24-2021
0

php concatenate variables to function

public function getAvg(string $var) {
  # A sample from a game I wrote.
  # Concatenatin on the other side is just {stuff.$var}
  # You can also concatenate multiple variables in a varaible:
  # {$varA.$varb}
  $min = $this->{$var._min};
  # Assigns to $min object property matching $var + '_min' string.
  $max = $this->{$var._max};
  # Assigns to $max object property matching $var + '_max' string.
  $avg = (($min + $max) / 2);
  return round($avg);
}
Posted by: Guest on May-19-2020

Code answers related to "how to combine variables and text into a string php"

Browse Popular Code Answers by Language