note 115651 added to function.dechex

From: Date: Mon, 01 Sep 2014 21:16:57 +0000
Subject: note 115651 added to function.dechex
Groups: php.notes 
Request: Send a blank email to php-notes+get-200356@lists.php.net to get a copy of this message
this base function convert string rgb to color <?php function rgb_to_color($rgb, $symbols=' '){ $color = ''; $arr = explode($symbols, $rgb); $count = count($arr); for($i=0; $i<$count; $i++){ $color .= dechex($arr[$i]); } return '#'.$color; } echo rgb_to_color('186 186 18'); // #baba12 echo rgb_to_color('186-186-18', '-'); // #baba12 ?> ---- Server IP: 72.52.91.14 Probable Submitter: 113.170.3.225 ---- Manual Page -- http://php.net/manual/en/function.dechex.php Edit -- https://master.php.net/note/edit/115651 Del: integrated -- https://master.php.net/note/delete/115651/integrated Del: useless -- https://master.php.net/note/delete/115651/useless Del: bad code -- https://master.php.net/note/delete/115651/bad+code Del: spam -- https://master.php.net/note/delete/115651/spam Del: non-english -- https://master.php.net/note/delete/115651/non-english Del: in docs -- https://master.php.net/note/delete/115651/in+docs Del: other reasons-- https://master.php.net/note/delete/115651 Reject -- https://master.php.net/note/reject/115651 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#200356) next »