Skip to content

Instantly share code, notes, and snippets.

View MrJSdev's full-sized avatar
🎯
Loading JS

Riyaz Khan MrJSdev

🎯
Loading JS
View GitHub Profile
<?php
$var = 8;
// Inline variable parsing
echo "I'd like {$var} mangoes"; // = "I'd like 8 mangoes
// String concatenation
echo "I'd like ".$var." mangoes"; // I'd like 8 mangoes
// Explicit cast
<html>
<body>
<h4>Browser Information</h4>
<?php
$browser="";
if(strrpos(strtolower($_SERVER["HTTP_USER_AGENT"]),strtolower("MSIE")))
{
$browser="Internet Explorer";
}
else if(strrpos(strtolower($_SERVER["HTTP_USER_AGENT"]),strtolower("CHROME")))
<?php
$text = 'How are you?';
if (strpos($text, 'are') !== false) {
echo 'true';
}
@MrJSdev
MrJSdev / array_string_check.php
Last active April 11, 2017 06:24
this is another post and its explanation of code snippets that we have posted at http://extracatchy.net
<php
function is_our_student($students, $stringtocheck)
{
foreach ($students as $name) {
if (stripos($stringtocheck, $name) !== FALSE) {
return true;
}
}
}
@MrJSdev
MrJSdev / array_string_check.php
Last active April 11, 2017 06:24
This is also the checking of array that contains specific word: The whole post is available at http://extracatchy.net
<?php
$students = array("Rahul, Salim, Aftab, Shahnawaz, Faizal, Sameer");
$stringtocheck = "Aftab";
if(is_our_student($students, $stringtocheck)) {
echo "It is our student.";
} else {
echo "Uknown child and he/she is not our student.";
<?php
$students = array("Rahul, Salim, Aftab, Shahnawaz, Faizal, Sameer");
$stringtocheck = "Aftab";
if(is_our_student($students, $stringtocheck)) {
echo "It is our student.";
} else {
echo "Uknown child and he/she is not our student.";
}
@MrJSdev
MrJSdev / page.php
Created April 15, 2017 02:35
This is the code guide of displaying page slug that I have posted at http://extracatchy.net
<?php
// Lets get the page slug
global $post;
$post_slug=$post->post_name;
// For display the data we need to echo it
echo $post_slug;
@MrJSdev
MrJSdev / page.php
Last active April 15, 2017 02:57
This another way of displaying page slug in WordPress. The full guide is available at http://extracatchy.net/retrieve-the-slug-of-current-page-wordpress/
<?php
// get page slug name
$slug = get_post_field( 'post_name');
// echo the $slug
echo $slug;
@MrJSdev
MrJSdev / android-root.html
Last active May 10, 2017 11:20
This is mobile rom code at http://extracatchy.net/lenovo-a7000-custom-roms/ and all roots guide will be available at http://extracatchy.net/blog/
/* Your warranty is now void.
*
* I am not responsible for bricked devices, or dead SD cards,
* nuclear war, penguin invasions or that you are getting fired because the alarm app failed.
* before flashing it! YOU are choosing to make these modifications, and
* If you point your finger at me for messing up your device, I will laugh at you. Hard
* If you dont like this rom, Stay away from this thread!
*/
<?php
$students = "Kavin, Arbaz, Salim, Neha, Nisha";
$separate = explode(',', $students);
print_r($students);