Tuesday, September 27, 2016

Best way to add/insert to array in php

<?php
$array = array();
for (
$x 1$x <= 100000$x++)
{
    
$array[] = $x;
}
?>
takes 0.0622200965881 seconds

and

<?php
$array 
= array();
for (
$x 1$x <= 100000$x++)
{
    
array_push($array$x);
}
?>

takes 1.63195490837 seconds

so if your not making use of the return value of array_push() its better to use the $array[] way.

Hope this helps someone.

Best way to add/insert to array in php

<?php
$array = array();
for (
$x 1$x <= 100000$x++)
{
    
$array[] = $x;
}
?>
takes 0.0622200965881 seconds

and

<?php
$array 
= array();
for (
$x 1$x <= 100000$x++)
{
    
array_push($array$x);
}
?>

takes 1.63195490837 seconds

so if your not making use of the return value of array_push() its better to use the $array[] way.

Hope this helps someone.

Wednesday, August 24, 2016

Line up text under Font Awesome icon

I am trying to display font awesome icon in a box like a button. I've been able to do that. So far so good...It'll look like this. without hover and with hover
HTML

 <div class="fa-hover">  
 <a href="www.awtsoft.com"><i class="fa fa-pencil-square-o fa-3x" aria-hidden="true"></i>New Post</a>   
 </div>  

CSS
 .fa-hover a {  
   overflow: hidden;  
   white-space: nowrap;  
   display: block;  
   color: #222;  
   line-height: 20px;  
   height: 80px;  
   padding: 10px;  
   border-radius: 4px;  
   border: 2px dotted greenyellow;  
 }  
 .fa-hover a:hover {  
   background-color: #1d9d74;  
   color: #fff;  
   text-decoration: none;  
 }  
 a i.fa {  
  display: block;  
  text-align: center;  
 }  

Total Pageviews