strrpos() is a string function in PHP used to find the position of the last occurrence of a substring (needle) in a string (haystack). strrpos(string $haystack, string $needle) strrpos(string $haystack, string $needle, int $offset) $str = “https://www.example.com/track?code=12345”; $pos = strrpos($str, ‘=’); echo $pos; // Output: 36 (position of the last “=”) Why use it? To… Continue reading What is strrpos()?
Tag: PHP
Difference Between Sleep() and Usleep() function in PHP
In PHP, you can delay execution using the sleep() or usleep() functions. These are the main differences between sleep and usleep functions Sleep: Takes time in seconds. Less precise because it works in whole seconds. Accepts integer values as the number of seconds. Primarily used for longer delays (whole seconds). Minimum delay is 1 second.… Continue reading Difference Between Sleep() and Usleep() function in PHP
Updated Version of PHP 8.3.0
PHP 8.3 introduces several new features, optimizations, and deprecations that enhance the language’s functionality, performance, and security. Here’s a detailed overview of the updates: Readonly Classes Readonly Keyword: PHP 8.2 introduced readonly properties, and PHP 8.3 extends this concept to entire classes. Declaring a class as readonly means all its properties are automatically readonly, ensuring… Continue reading Updated Version of PHP 8.3.0
YII Frame Work
Yii is a high-performance PHP framework used for developing web applications. It’s an open-source framework that follows the MVC (Model-View-Controller) architectural pattern, which helps in organizing code and separating concerns. Features of Yii Framework: High Performance: Yii is known for its high performance. It is built with performance optimization in mind and utilizes caching mechanisms,… Continue reading YII Frame Work
PHP code used in Heroku to call suitelet in the Netsuite when an event happens in Shopify
<?php $_POST = json_decode(file_get_contents(‘php://input’), true); $data = $_POST; if (!empty($data[‘id’])) { $data[‘type’] = $_GET[‘type’]; $curl = curl_init(); curl_setopt_array($curl, array( CURLOPT_URL => “https://tstdrv2353842.extforms.netsuite.com/app/site/hosting/scriptlet.nl?script=827&deploy=2&compid=TSTDRV2353842&h=ac7c8e9778d66cb92ffc”, CURLOPT_RETURNTRANSFER => true, CURLOPT_ENCODING => “”, CURLOPT_MAXREDIRS => 10, CURLOPT_TIMEOUT => 30000, CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1, CURLOPT_CUSTOMREQUEST => “POST”, CURLOPT_POSTFIELDS => json_encode($data), CURLOPT_HTTPHEADER => array( “accept: */*”, “accept-language: en-US,en;q=0.8”, “content-type: application/json”, “User-Agent: Mozilla/5.0” ),… Continue reading PHP code used in Heroku to call suitelet in the Netsuite when an event happens in Shopify