fork download
  1. <?php
  2.  
  3. function buildCodeHtml($name, $model, $marca, $stock) {
  4. $html = <<<HTML
  5.   <div class="form-group">
  6.   <label>$name</label>
  7.   <input type="text" class="form-control" placeholder="$name" required maxlength="30" name="prod-name">
  8.   </div>
  9.  
  10.   <div class="form-group">
  11.   <label>$model</label>
  12.   <input type="text" class="form-control" placeholder="$model" required maxlength="30" name="prod-model">
  13.   </div>
  14.  
  15.   <div class="form-group">
  16.   <label>$marca</label>
  17.   <input type="text" class="form-control" placeholder="$marca" required maxlength="30" name="prod-marca">
  18.   </div>
  19.  
  20.   <div class="form-group">
  21.   <label>$stock</label>
  22.   <input type="text" class="form-control" placeholder="$stock" required maxlength="20" pattern="[0-9]{1,20}" name="prod-stock">
  23.   </div>
  24. HTML;
  25.  
  26. return $html;
  27. }
  28.  
  29. /* Imprime */
  30. echo buildCodeHtml("Nome 2", "Modelo 2", "Marca 2", 123456);
  31. echo buildCodeHtml("Nome 3", "Modelo 3", "Marca 3", 6);
Success #stdin #stdout 0.02s 23684KB
stdin
Standard input is empty
stdout
    <div class="form-group">
       <label>Nome 2</label>
       <input type="text" class="form-control"  placeholder="Nome 2" required maxlength="30" name="prod-name">
    </div>

    <div class="form-group">
       <label>Modelo 2</label>
       <input type="text" class="form-control"  placeholder="Modelo 2" required maxlength="30" name="prod-model">
    </div>

    <div class="form-group">
       <label>Marca 2</label>
       <input type="text" class="form-control"  placeholder="Marca 2" required maxlength="30" name="prod-marca">
    </div>

    <div class="form-group">
       <label>123456</label>
       <input type="text" class="form-control"  placeholder="123456" required maxlength="20" pattern="[0-9]{1,20}" name="prod-stock">
    </div>    <div class="form-group">
       <label>Nome 3</label>
       <input type="text" class="form-control"  placeholder="Nome 3" required maxlength="30" name="prod-name">
    </div>

    <div class="form-group">
       <label>Modelo 3</label>
       <input type="text" class="form-control"  placeholder="Modelo 3" required maxlength="30" name="prod-model">
    </div>

    <div class="form-group">
       <label>Marca 3</label>
       <input type="text" class="form-control"  placeholder="Marca 3" required maxlength="30" name="prod-marca">
    </div>

    <div class="form-group">
       <label>6</label>
       <input type="text" class="form-control"  placeholder="6" required maxlength="20" pattern="[0-9]{1,20}" name="prod-stock">
    </div>