PHP code example of tixelrocks / class-constants-helper
1. Go to this page and download the library: Download tixelrocks/class-constants-helper 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/ */
tixelrocks / class-constants-helper example snippets
class Artist {
const ARTIST_TYPE_MUSICIAN = 0;
const ARTIST_TYPE_COMEDIAN = 1;
const ARTIST_TYPE_MAGICIAN = 2;
}
html
<select>
@foreach (constants(Artist::class, 'ARTIST_TYPE') as $value)
<option value="{{ $value }}">{{ $value }}</option>
@endforeach
</select>