Category: Php
How to get index values of an array using php
$topcom=array(‘color’=>’red’,’type’=>’box’,’height’=>’10px’,’weight’=>’2kg’); How to get the... Read MoreHow to find Count of an array in php
Using the function count(); we can find the number of elements in a array. $num[]=array(1,2,3,4,5); echo count($num); will returns 5.... Read MoreUnique id generation in php
Using the function uniqid(); we can generation unique id in php. This will use current time stamp in micro second and generate unique id. ... Read MoreCookies in PHP
Cookies are used to store information in browser itself. Server used to send information to clients browser. Then browser store all those details in small text files in users computer. Cookies used to... Read MoreGetting first 3 letters of a string in php
Substring function in php: $myword=”Hai how are you?”; $result = substr($myword, 0, 3); echo $result ; Result will be “Hai”;... Read MoreHow to solve cross domain issue in php
Add below on the top of the php page: header(“Access-Control-Allow-Origin: *”);... Read MoreHow to retrieve the last element in an array using php
Using end() function we can retrieve the end index value in an array: $endvalue= end($sample_array); echo $endvalue;... Read MoreCalling remote url in php
File get contents: To display a contents in a remote url : echo $file = file_get_contents(‘http://www.example.com/’); Php curl <?php $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, ... Read MoreTo write contents into a file using php:
Print array to file php: Here array : $woocommerce File name : filename-sample.txt file_put_contents(‘filename-sample.txt’, print_r($woocommerce, true));... Read More- 3 of 4
- « Previous
- 1
- 2
- 3
- 4
- Next »