$archive = RarArchive::open('archive.rar');
$entries = $archive->getEntries();
foreach ($entries as $entry) {
$entry->extract('/extract/to/this/path');
}
$archive->close();
<?php
class Struct {
public $id = '';
public $name = '';
public $color = '';
public function __construct($id, $name, $color) {
$this->id = $id;
$this->name = $name;
$this->color = $color;
}
}
$array = [new Struct(0, 'name', '#d00'), new Struct(1, 'name2', '#0d0')];
echo $array[0]->name;
?>
function format_big_numbers($number, $delimiter) {
$len = strlen($number);
if ($len > 3){
if ($len % 3 == 0) {
$split = str_split($number, 3);
$number_with_commas = implode("$delimiter", $split);
return $number_with_commas;
}
else if ($len % 3 == 1) {
$front = substr($number, 0, 1);
$split = substr($number, 1, $len - 1);
$split = str_split($split, 3);
$number_with_commas = implode("$delimiter", $split);
$number_with_commas = $front . "$delimiter" . $number_with_commas;
return $number_with_commas;
}
else {
$front = substr($number, 0, 2);
$split = substr($number, 2, $len - 2);
$split = str_split($split, 3);
$number_with_commas = implode("$delimiter", $split);
$number_with_commas = $front . "$delimiter" . $number_with_commas;
return $number_with_commas;
}
}
else {
return $number;
}
}
$num = '1234567891234567891234567891234';
echo format_big_numbers($num, ","); // output is 1,234,567,891,234,567,891,234,567,891,234
<div class="currency">
<ul>
<?php
for ( $i = 0; $i < $count_obj; $i++ ) {
if ( $obj[ $i ][ 'percent_change_24h' ] > 0 ) {
$color_change = '#4ac06a';
$plus = '+';
} else {
$color_change = '#ff8d8d';
$plus = '';
}
?>
<li><i class="cc <?=$obj[$i][" symbol "]?> iconsi" title="<?=$obj[$i][" name "]?>"></i>
<div class="block_coin">
<span class="coin_name">
<?=$obj[$i]["name"]?>
</span>
<span style="color:<?=$color_change?>;" class="coin_price">
<?=$obj[$i]["price_usd"]?>$</span>
<span style="color:<?=$color_change?>;" class="coin_change">(<?=$plus.$obj[$i]["percent_change_24h"]?>%)</span>
</div>
</li>
<?php
}
?>
</ul>
</div>