Follow me:
Archives
- ajax
- apache
- array
- attachement
- attachementphp
- best practice
- branch
- case
- cmd
- comment
- convert
- css
- csv
- curl
- curl_init
- date
- db
- download
- duplicate
- editor
- encoding
- entities
- error
- export
- form
- git
- htaccess
- html entities
- IDE
- if clause
- imp
- import
- javascript
- jquery
- login
- mcv
- merge
- microtime
- multiple select
- mysql
- NetBeans
- notepad
- outlook
- php
- phpdoc
- phpmyadmin
- posts_per_page
- query_posts
- regex
- request
- rewrite
- se
- serializing
- server
- server variables
- service
- service class
- smarty
- sql
- standards
- string
- superglobals
- text edit
- time
- timestamp
- tools
- update
- utilities
- wkhtmltopdf
- wordpress
- xampp
- zend
Category Archives: PhP
Run PHP Compatibility checks for upgrading version
Description: In order to bring the PHP version up to date, we need to run compatibility test on our projects. Solution: The CodeSniffer tool that can be installed on each system gives us the most precise results. Follow the guide … Continue reading
Requirements for sending e-mails from PHP
Description: We need to send e-mails directly from a PHP script. Solution: First, in php.ini the smtp port should be set to 25, but this is usually by default. To locate your php.ini file in the server configuration you can use … Continue reading
Posted in Linux, PhP, Wordpress
Tagged attachement, mail, nginx sendmail, php email, sendmail, server, wp_mail
Leave a comment
substr() cuts in the middle of & symbol
Description: In “Read more” segments, you often need to cut the text to a length and add ‘…’ at the end. This can be a bit tricky when the limit falls on a special character. Solution: We can use mb_substr() … Continue reading
Reversing an Array in PhP
Description: Having an array, how to easily do to reverse the order of the elements. Solution: PhP offers an out-of-the box solution to this issue. It is the function array_reverse() which inverts the order of the array elements. A point to take … Continue reading
Add line break in PDF generated from HTML without fix width
Description: By creating a PDF from HTML if you use tables and you want the table cells to flow easily not depending on the width of a specific cell, a long text is not broken into multiple lines, but the … Continue reading
Format number with decimals without rounding
Description: Trying to get a precise number of decimal in a number results most of the times in a rounding of the number. Both round() and number_format() functions of PhP round the output result. Solution: The solution to this issue is to … Continue reading
301 and 302 redirect, differences and implementation
Description: Is there any difference between 301 and 301 redirects ? Solution: Practically, there is limited difference between the two. To be precise, 301 redirect signals a permanent move of the page, while 302 reffers to a temporary move. This … Continue reading
Convert StdClass objects to SOAP compliant objects
Description: Having an obtained StdClass Object, we require to change it into a SOAP structure object or Array compliant. Solution: Converting a StdClass Object with PhP basically means iterating the object and populating the public properties with elements from the … Continue reading
Get current and past month with Zend Date
Description: Return current and previous months in Zend Framework, considering passing into a new year as well. Solution: Zend Framework, through Zend_Date() offers a quick solution for this problem. With the get() function we can return any part of the current date, and with … Continue reading
Send e-mail with attachments in Zend Framework
Description: Send an e-mail containing attachments with Zend Framework. Solution: Zend offers an easier solution for sending e-mail with attachements than plain PhP. Basically the object has to be instantiated and then just configuring the parameters. Example: $email_body = “<div>Body … Continue reading