Results 1 to 4 of 4

Thread: What is the variable interpolation in PHP?

  1. #1
    Join Date
    May 2013

    What is the variable interpolation in PHP?

    Hello Guys,
    Please let me help to know that What is the variable interpolation in PHP? please share you feedback on this.
    Thank for any reply.

  2. #2
    Join Date
    Feb 2012
    Pensacola, FL
    Is this a question you have on homework?

    Variable interpolation is basically just using a variable in a string or expression.

    PHP Code:
    $first_name "John";
    $last_name "Doe";

    $fn_count strlen($first_name);
    $ln_count strlen($last_name);

    "Hello {$first_name} {$last name}.  Your first name contains {$fn_count} character and your last name contains {$ln_count} characters."

  3. #3
    Join Date
    Aug 2004
    PHP supplies many ways to use variables within strings, including interpolation within double-quoted and "heredoc" strings. Read all about it in the manual page on the string type.
    "Well done....Consciousness to sarcasm in five seconds!" ~ Terry Pratchett, Night Watch

    How to Ask Questions the Smart Way (not affiliated with this site, but well worth reading)

    My Blog
    cwrBlog: simple, no-database PHP blogging framework

  4. #4
    Join Date
    Jun 2013
    In computer programming, variable interpolation is the process of evaluating an expression or string literal containing one or more variables, yielding a result in which the variables are replaced with their corresponding values in memory. It is a specialized instance of concatenation.

    Languages that support variable interpolation include Perl, PHP, Ruby, Tcl, Groovy, and most Unix shells. In these languages, variable interpolation only occurs when the string literal is double-quoted, but not when it is single-quoted. The variables are recognized because variables start with a sigil (typically "$") in these languages.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
HTML5 Development Center