<?php

function buildCodeHtml($name, $model, $marca, $stock) {
    $html = <<<HTML
    <div class="form-group">
       <label>$name</label>
       <input type="text" class="form-control"  placeholder="$name" required maxlength="30" name="prod-name">
    </div>

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

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

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

    return $html;
}

/* Imprime */
echo buildCodeHtml("Nome 2", "Modelo 2", "Marca 2", 123456);
echo buildCodeHtml("Nome 3", "Modelo 3", "Marca 3", 6);