PHP – Extract youtube id from youtube url / link

Today I wanted to be able to extract the youtube unique id for the video so that I could automatically embed any youtube video in my webpage.

What I wanted to be able to do was let the user copy + paste in a youtube url such as and extract the value of the key ‘v’ which is obviously the video id.

After a short while I ran into a stackoverflow question which had an awesomely simple answer;

$url = "";
parse_str( parse_url( $url, PHP_URL_QUERY ), $my_array_of_vars );
echo $my_array_of_vars['v'];    
  // Output: C4kxS1ksqtw

So what this means is that I can now just do the following to embed any youtube video in to a page;

$url = ";feature=relate"; 
parse_str( parse_url( $url, PHP_URL_QUERY ), $my_array_of_vars ); 
<i frame src="<?php echo $my_array_of_vars['v']; ?>" frameborder="0" width="560" height="315">
</i frame>

*remove space between i frame (was to stop it from showing in the post)

Android – How to deploy your android app without the market place or google play

I’m currently working on an app which I need to deploy to a group of people however I don’t want to deploy it to the market as it’s not ready for public consumption yet.

So I did a bit of googling and found that in order to deploy your app to other android phones you can do a couple of things;

1) Upload the .apk file directly on a server somewhere on the net and let users download the apk file to install

This method will allow users to open their android browser and type in the URL (e.g. or Once they have opened the page it will begin the download of the apk file and then run the user through the install process. However, its important that the user has gone to Settings > Applications > Unknown Sources and enabled this option! Otherwise the application will not install!

2) Similar to the first for deployment but you can digitally sign your app

see here;

3) Get the user to download the apk file and then mount their phone on the computer and drag over the apk file to the handset

I’m not a huge fan of this one as it might be a bit too complex for some people.

Eventually I’ve used the hosted apk solution (see 1) and on a page somewhere I’ve added a url for them to type and also a qr code to scan (make sure you generate a URL qr code and not a text version otherwise the browser may not load the url). Using the QR code method will allow the user will be taken directly to the url, making the user’s lifea little bit easier as they have nothing to type.