I am using dump($value)
function. I have an associative array with lots of entries in it. I need to see the values right away without having to click the expansion button when dumped. I can use var_dump()
to see it right away but I like it more using dump because it is modern and interactive. Below is the snapshot of dump function:
Here's a quick format tool, no need to use laravel: (Source)
$pretty = function($v='',$c=" ",$in=-1,$k=null)use(&$pretty){$r='';if(in_array(gettype($v),array('object','array'))){$r.=($in!=-1?str_repeat($c,$in):'').(is_null($k)?'':"$k: ").'<br>';foreach($v as $sk=>$vl){$r.=$pretty($vl,$c,$in+1,$sk).'<br>';}}else{$r.=($in!=-1?str_repeat($c,$in):'').(is_null($k)?'':"$k: ").(is_null($v)?'<NULL>':"<strong>$v</strong>");}return$r;};
echo $pretty($array);
Here's a screenshot of sample output, as well. (Bonus points for figuring out what the data is)