Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- /*
- * @author ri7nz <ri7nz.labs@gmail.com>
- */
- function toAttributes($arr){
- $arr = array_map(
- function($value, $key){
- return $key.'="'.$value.'"';
- },
- array_values($arr),
- array_keys($arr)
- );
- return implode(' ', $arr);
- }
- $attr = array(
- 'id' => 'input1',
- 'class' => 'form-control',
- 'name' => 'input1'
- );
- $attr = toAttributes($attr);
- echo "<input type='text' ${attr} />";
Add Comment
Please, Sign In to add comment