- Strength to Increase Rep
- +0
- Strength to Decrease Rep
- -0
- Upvotes Received
- 1
- Posts with Upvotes
- 1
- Upvoting Members
- 1
- Downvotes Received
- 0
- Posts with Downvotes
- 0
- Downvoting Members
- 0
10 Posted Topics
# SEO URL Redirection Basics: TUTORIAL # First you can see/get/use some code here. <?php /** * Redirect the visitor to another URL using a proper status code. * * @param string $URL * @param int $StatusCode * @copyright Claude "CodeAngry" Adrian * @license http://www.wtfpl.net/ */ function RedirectURL($URL = null, …
*I appologise for the late reply, but it should help posterity.* Consider [ipcountryphp](http://ipcountryphp.com/) *(my site, my code, my honour)* as it provides a local internet-lifetime freely updated database. It's fast and fully self-contained, pluggable into anything PHP 5.3, SQLite3 and beyond. Very fast seeks and no performance penalties. **Enough with …
<?php $function_names = ['myvalueone','myvaluetwo','myvaluethree','myvaluefour','myvaluefive']; $functions = array(); foreach($function_names as $function_name){ // You need to use (the variable) to import it in the function $functions[$function_name] = function() use ($function_name){ // <-- USE echo 'The name of the function is ', $function_name, PHP_EOL; }; // Store nicely in array call_user_func($functions[$function_name]); // I …
The problem is that we need to know if the `std::string()` holds the `Windows CP` or `UTF8`, or something else... Decoding is different for each codepage. Also look into `std::wstring_convert` for `UTF8`. @**triumphost**'s solution is unsafe in regards to multibyte `std::string`.
<?php /** * Replace stuff in a file. * * @throws InvalidArgumentException if $file is not a proper string * @param path $file * @param string $find * @param string $replace * @param bool $case_insensitive * @return bool */ function find_replace($file, $find, $replace, $case_insensitive = true){ // Validate arguments if(!is_string($file) …
Coding tip: **never leave open elses.** Like **if(true) { ...; } else ...;** Alway wrap both sides: **if(true) { ...; } else { ...; }** *You leave yourself open to hard to find bugs with this.*
**NuSphere PhpEd** but it costs money. It has no rival in speed. Parses 10s of thousands of lines of php for code completion in seconds. All others choked on my projects *(as in minutes to load)*.
**Time is a relative thing... consider using GMT time.** Also keep in mind that any **date, time, datetime can be converted to an integer**. And **comparing integers is easy** :)
Use **headers_sent()** function and see where output started. Then mend it! Also make sure your files don't carry a UTF8 BOM. PHP kind of chokes on it...
**You need to do output buffering.** Parse the markup for **@href** and **@src** attributes and start normalizing them. For **normalizing urls**... it's quite easy. Break by separators '/' into an array *(keep note if it ends in /)*, exclude single dots, exclude two dots and preceeding element *(if any)* in …
The End.
CodeAngry