in_array with two dimension array

php in_array with two dimension array .

This is simple code that you can use it

Array ( [0] => Array ( [id] => 9545 [store] => Some Store Name )[1] => Array ( [id] => 9544 [store] => Some Store Name );

$id = 9545;
$store = 'Some Store Name';
if (in_array(array('id' => $id, 'store' => $store), $array)) {
 print "Found!";


hope it works. if you find any problem then give a comment.

JavaScript how to remove http:// from url

Sometime we need to remove https or http from url. We can do it using javascript. Here is simple code

url = url.replace(/^https?:\/\//,'');

If you face any problem then please give me a comment.

Get all href value using jquery and replace it

Sometime we need to get all href link value and then check this value and update link value. we can do it using simple jquery each function. Here is simple code

<script type="text/javascript">
$('a').each(function() {
var value = $(this).attr('href');
$(this).attr('href', '');

if you find any problem then give me a comment.

Javascript Code for Line Break Removal

Simple Javascript code for removing three types line break. here is simple code

//We define the text variable.

Var someText = "Here's is simple some text.\n It has some line breaks that will be removed from string \r using Javascript.\r\n";

<span class="cmt">//This javascript code removes all 3 types of line breaks</span>
someText = someText.replace(/(\r\n|\n|\r)/gm,"");

Current instance of ck editor

For get current name of instance of ck editor you can use this code.

 var currentEditor;
  for(var id in CKEDITOR.instances) {
  CKEDITOR.instances[id].on('focus', function(e) {
 // Fill some global var here
  currentEditor =;

if you face any problem please give a comment.

Tab index auto jump

Some time need tab auto jump when max length is covered. We can do it easily simple html and javascript code

First create simple html code

<input size="2" tabindex="1" id="one"
maxlength="2" onkeyup="toUnicode(this)" />

<input size="2" tabindex="2" id="two"
maxlength="2" onkeyup="toUnicode(this)" />

<input size="2" tabindex="3" id="three"
maxlength="2" onkeyup="toUnicode(this)" />


then create javascript code.

function toUnicode(elmnt)
  var next;
  if (elmnt.value.length==elmnt.maxLength)
    next=elmnt.tabIndex + 1;
    //look for the fields with the next tabIndex
    var f = elmnt.form;
    for (var i = 0; i < f.elements.length; i++)
      if (next<=f.elements[i].tabIndex)


hope this is helpful. If you face any problem then please give a comment.


Get selected text or image in ck editor

Some time we need to get selected text or image for ck editor. We can do it easily here is simple code.


 var selection = CKEDITOR.instances['content'].getSelection();
 if (selection.getType() == CKEDITOR.SELECTION_ELEMENT) {
 var selectedContent = selection.getSelectedElement().$.outerHTML;
 } else if (selection.getType() == CKEDITOR.SELECTION_TEXT) {
 if ( {
 selectedContent = selection.getNative().createRange().text;
 } else {
 selectedContent = selection.getNative();
 console.log("The selectedContent is: " + selectedContent);

if you find any problem then give a comment


Web Development Resource

UI and UX Design

User Interface and User Experience

php tutorial

code,Tips,Tricks in php,mysql,javascript,jquery,ajax,yii,codeigniter,laravel,drupal,slim,bootstrap,api,jQuery Mobile