PHP code example of flsouto / htattrs
1. Go to this page and download the library: Download flsouto/htattrs library. Choose the download type require. 2. Extract the ZIP file and open the index.php. 3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
flsouto / htattrs example snippets
s = new FlSouto\HtAttrs();
$attrs['name'] = 'test';
$attrs['onclick'] = 'alert("Test!")';
echo "<a $attrs>Click me</a>";
s = new FlSouto\HtAttrs([
'name' => 'test',
'onclick' => 'alert("Test!")'
]);
echo "<a $attrs>Click me</a>";
s = new FlSouto\HtAttrs([
'name' => 'test',
'onclick' => 'alert("Test!")'
]);
$attrs['style']['color'] = 'black';
// it's also possible to get the object:
$style = $attrs['style'];
$style['padding'] = '5px';
echo "<a $attrs>Click me</a>";