Skip to main content

PHP , MEMORY, die function, hidestring,

Only variables should be passed by reference
$tmp = explode('.', $file_name);
$file_extension = end($tmp);
---
 public function register_user($user){ 
 
   $this->db->set($user);
$insert =   $this->db->insert('user');
if ($insert){
   return $this->db->insert_id();
}
else {
return false;
}
 
   }

 public function register_user($user){ 
   $this->db->set($user);
  $insert =   $this->db->insert('user');
if ($insert){
   return $this->db->insert_id();
}
else {
return false;
}
 
   }

 $this->db->set($feild);

            $insert = $this->db->insert($tablename);
            if ($insert):
                return $this->db->insert_id();
            endif;
        else: return "Invalid Input Provided";

_______________________________________________________________

Just add this below line to before line of you getting error in your file

ini_set('memory_limit', '-1');

It will take unlimited memory usage of server, it's working fine.

_______________________________________________________________

die( ) function is used to display a message and exit the script. It may be used to print alternate message . Instead of showing error it will show the user friendly message.
die( ) function is only used to print string messages .value of variables cannot print with die( ) function.
________________________________________________________________

<?php
function maskPhoneNumber($number){
 
    $mask_number =  str_repeat("*", strlen($number)-4) . substr($number, -4);
 
    return $mask_number;
}
echo maskPhoneNumber('08066417364');
?>
____________________________________________________________________

http://programmerblog.net/create-restful-web-services-in-codeigniter/
______________________________________________________________________

NOTE : Check htaccess when setup ci project anywhere.(if not gives page not found error.)
Check database and model load (if gives model load error)

______________________________________________________________________

## UNSET POST VARIABLES
<?php
if (!isset($_SESSION)) {
    session_start();
}

if ($_SERVER['REQUEST_METHOD'] == 'POST') {
    $_SESSION['postdata'] = $_POST;
    unset($_POST);
    header("Location: ".$_SERVER['PHP_SELF']);
    exit;
}
?>













Comments