php
php - make youtube embed code from an url
A small php function that transforms a youtube url in its embed script.
- liviu's blog
- Login or register to post comments
- Read more
Php include_once equivalent for javascript
This one time, in band camp, when i was working on a javascript... script i needed an equivlent for the include_once in php. It was very likely that the code where i was including something got to run multiple times, and this caused problems.
So i found the solution on phpied.com.
So here it is, the php include_once equivalent for javascript:
var included_files = new Array();
function include_once(script_filename)
{
- liviu's blog
- Login or register to post comments
- Read more
Php functions in javascript
A bunch of nice people started a project where they port php functions (eg: addslashes) to javascript. So if you have experience in php and you think at some point "I wish i would have this php function in javascript" you might be lucky enough to find it on their site. When i wrote this they ported 399 functions.
- liviu's blog
- Login or register to post comments
- Read more
Tips for speeding up php scripts
Taken from
Programming PHP, 2nd Edition
By Rasmus Lerdorf, Peter MacIntyre, Kevin Tatroe
Optimizing Execution Time
Here are some tips for shortening the execution times of your scripts:
- liviu's blog
- Login or register to post comments
- Read more
php security tips
Again from the book
- liviu's blog
- Login or register to post comments
- Read more
A good free php book
I was reading a good free php book to remind me some php things.
It covers things in php 5.
It's called
- liviu's blog
- Login or register to post comments
- Read more
How to see php errors in firebug
If you want to see php errors in firebug here is how you do it: <?php
/**
* class: Debugger
* author: <a href="http://doru.serveblog.net">Moisa Doru</a>
* contact: <a href="mailto:moisadoru@gmail.com">moisadoru@gmail.com</a>
* info: this class displays PHP errors in Firebug; works only in PHP5, tested in PHP 5.2.0
* usage: <strong>include_once("debugger.php")</strong> as the very first include();
* licence: free as in free beer ;)
*/
- liviu's blog
- Login or register to post comments
- Read more
A nice way to get the value of a $_GET in php
Here is a nice way to get the value of a $_GET in php (i think it will also work with $_POST)
function get($value)
{
$valoare = isset($_REQUEST[$value]) ? addslashes(strip_tags($_REQUEST[$value])) : '';
return $valoare;
}
- liviu's blog
- Login or register to post comments
How to block an ip from viewing your adsense ads
I saw this here i think.
It's a simple way to block certain ip's you might suspect want to give you invalid clicks to get you banned in adsense.
Of course first you have to have a list of ip's you suspect to be ill intentioned, and that isn't very likely to happen in the real world, but if you do, here is what you could do.
- liviu's blog
- Login or register to post comments
- Read more
How to reindex an array in php
If you have an array and want to reindex it to have the keys starting from 0 and be consecutive, you can use array_values, which does just that.
You can use it when lets say you want to iterate through it with a for (and not a foreach).
- liviu's blog
- Login or register to post comments