23 Dec, 2024

PHP type cast float to int

Description int intval ( mixed $var [, int $base = 10 ] ) Parameters Description $var : The value which converted to an integer $base : Conversion base Examples <?phpecho intval(42); // 42echo intval(4.2); // 4echo intval(’42’); // 42

Share your Love
1 min read

PHP file Download Script

This article represent you how to download any files from php web server to local machine. This application works mainly on the header of the PHP. Demo: <?php $file = ‘monkey.gif’; if (file_exists($file)) { header(‘Content-Description: File Transfer’); header(‘Content-Type: application/octet-stream’); header(‘Content-Disposition: attachment; filename=’.basename($file)); header(‘Content-Transfer-Encoding: binary’); header(‘Expires: 0’); header(‘Cache-Control: must-revalidate’); header(‘Pragma: public’); header(‘Content-Length: ‘ . filesize($file)); ob_clean(); […]

Share your Love
1 min read

Install Send Mail Function in nginx Server ubuntu

First of all check send mail function is install in to that server to check that Please execute this command in termianal vds@vps:/etc$ netstat -ntpl You Found result like this (No info could be read for “-p”: geteuid()=1000 but you should be root.)Active Internet connections (only servers)Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program […]

Share your Love
1 min read

Send Mail in php

Description bool mail ( string $to , string $subject , string $message [, string $additional_headers [, string $additional_parameters ]] )   Using mail() to send a simple email:  <?php// The message$message = “Line 1rnLine 2rnLine 3”;// In case any of our lines are larger than 70 characters, we should use wordwrap()$message = wordwrap($message, 70, “rn”);// Sendmail(‘caffeinated@example.com’, ‘My Subject’, $message);?>

Share your Love
1 min read