PSD to HTML conversion PSD to HTML conversion PSD2HTML.com with over 300 professionals takes the designs to HTML and beyond

Subscribe to The Thread

  1. Alexander Rath says:

    Mind you can also do that with more $s:

    And you can use curly brackets:

  2. Alexander Rath says:

    Mind you can also do that with more $s:

    <?php
    
      $var1 = 'var2';
      $var2 = 'nameOfVariable';
    
      $nameOfVariable = 'The value I want!';
    
      echo $$$var1;
    
    ?>

    And you can use curly brackets:

    <?php
    
      $var1 = 'nameOf';
      $var2 = 'TheVariable';
    
      $nameOfTheVariable = 'Another value I want!';
    
      echo ${$var1 . $var2}; // Use concatenation to generate the variable name and then access it //
    
    ?>
  3. Wow! I never even knew about this. Might be a pretty great asset in the future.

  4. Mahesh says:

    I would like to ask a question, How to show variable in between the text.
    E.g., I have
    “var1 = $_POST['username'];”

    I want to show it something like this,
    “Hello [username]“.

    How to do it?

    I tried this but it didn’t work,
    “echo Hello $var1;”

    Please help me regarding this.

  5. sreevisakh says:

    Try like this

    $var=$_POST['username'];
    echo ‘Hello['.$var.']‘;

  6. If you need to create variables from an array there are two options.

    The first uses php extract()

     'Baylor', 'email' => 'baylor@example.com'));
    echo $name; // Baylor
    echo $email; // baylor@example.com
    
    // example: http://baylorrae.codepad.org/VdIA118O
    

    The second options which will give you more control is php list()

    <?php
    
    list($name, $email) = array('Baylor', 'baylorrae@gmail.com');
    
    echo $name;
    echo $email;
    
    // example: http://baylorrae.codepad.org/WejSCaCB
    
  7. perpleXa says:

    this is really bad practice and with proper code you should not need that mutation of code.

    also, don’t directly output $_POST/$_GET or $_REQUEST content without using htmlentities() around it, as your site might be vulnerable to cross-site-scripting and other injections.

Speak, my friend

At this moment, you have an awesome opportunity* to be the person your mother always wanted you to be: kind, helpful, and smart. Do that, and we'll give you a big ol' gold star for the day (literally).

Posting tips:
  • You can use basic HTML
  • When posting code, please turn all
    < characters into &lt;
  • If the code is multi-line, use
    <pre><code></code></pre>
Thank you,
~ The Management ~