This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$string = 'Weekend php'; | |
$length = strlen($string); | |
echo "Length: " . $length; | |
echo "<br>"; | |
$iteration =1; | |
for ($i=($length-1) ; $i >= 0 ; $i--) { | |
echo $string[$i]; | |
$iteration++; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$num=121; | |
$p=$num; | |
echo "sum " . $sum; | |
while((int)$num!=0) | |
{ | |
$rem=$num%10; | |
$sum=$sum*10+$rem; | |
$num=$num/10; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// your code goes heref | |
function getAngle( $h, $m ) | |
{ | |
//conver hrs and mins to degrees | |
$degreeHour = $h * 5 * 6; | |
$degreeMinute = $m * 6; | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// your code goes heref | |
function getRemainder( $n, $d ) | |
{ | |
for($i =1; $i<$n; $i++) { | |
if( $n == $d*$i) { | |
$remainder = 0; | |
$quotient = $i; | |
break; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if ($array == array_intersect(range(min($array), max($array)), $array))) { | |
//in sequence | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// To sort multidimentional array | |
public function array_msort($array, $cols) | |
{ | |
$colarr = array(); | |
foreach ($cols as $col => $order) { | |
$colarr[$col] = array(); | |
foreach ($array as $k => $row) { $colarr[$col]['_'.$k] = strtolower($row[$col]); } | |
} | |
$eval = 'array_multisort('; | |
foreach ($cols as $col => $order) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
console.log(Number(monthly_income).toLocaleString()); | |
console.log(Number(monthly_income).toLocaleString('en')); | |
toLocaleString is obselete | |
https://syedabdulbaqi.wordpress.com/2009/03/10/javascript-function-for-converting-string-into-indian-currency-format/ | |
//function for converting string into indian currency format | |
function intToFormat(nStr) | |
{ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
INSERT INTO `countries` (`id`, `name`) VALUES | |
(1, 'India'), | |
(2, 'Afghanistan'), | |
(3, 'Akrotiri'), | |
(4, 'Albania'), | |
(5, 'Algeria'), | |
(6, 'American Samoa'), | |
(7, 'Andorra'), | |
(8, 'Angola'), | |
(9, 'Anguilla'), |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$db = JFactory::getDbo(); | |
$query = $db->getQuery(true); | |
$query | |
->select($db->quoteName(array('a.bid_date', 'a.user_id', 'b.auction_name'))) | |
->from($db->quoteName('#__lots_bid', 'a')) | |
->join('INNER', $db->quoteName('#__auction_mgmt', 'b'). ' ON (' . $db->quoteName('a.auction_catalog_id'). ' = '. $db->quoteName('b.auction_catalog_id'). ')') | |
->where($db->quoteName('a.user_id'). ' = '. $userid); | |
// echo $query; | |
$db->setQuery($query); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
scp [email protected]:foobar.txt /some/local/directory | |
http://www.hypexr.org/linux_scp_help.php |