Home   -   Computerkurs   Demos   Editpointstatic   Folderwatcher   Gipsydrive   Licenses   Shrinkseries   V4   More...  

All   Asm   Bas   C   C++   C#   Couch   CSS   HTML   Java   JS   Lisp   OPAL   PHP   Perl   PS   Py   SQL   Win  

Previous page Home chapter Next page

Downtown Programmer's Corner   -   Demos

PHP

PHP ...

.

.

Strings

Determine how far two strings are identical

Problem: We have two strings and want know, up to which position they are identical.

A cool solution is found on Stackoverflow in tread "Find first character that is different between two strings", in the posting by ircmaxell on 2011-September-19. He says: "... when you xor two strings, the characters that are the same will become null bytes (chr(0)) ...". (# 20110923.0722).   BTW ircmaxell writes nice PHP articles in his blog blog.ircmaxell.com (# 20110923.0722).  

In esp/esp.index.php in function # 20110923.0721 it looks like this:

   $s1 = $_SERVER['HTTP_REFERER']; // "http://localhost/eps/testpage.html";
   $s2 = $_SERVER['SCRIPT_URI']    // "http://localhost/eps/eps/index.php";
   $sXor = $s1 ^ $s2;
   $iPos = strspn($sXor, chr(0));
   $sTail1 = substr($s1, $iPos);   // = "testpage.html"
   $sTail2 = substr($s2, $iPos);   // = "eps/index.php"

.


Send HTTP request

.

Stackoverflow thread   How to send a GET request from PHP?   is enumerating some methods to do the job (# 20111212.2121). Thread

.

Jörg Krause: Kochbuch PHP5, (c) 2005 Carl Hanser Verlag München Wien, ISBN 3-446-22736-9, 508 pages, www.hanser.de/computer (# 20101220.2021) (Demos from this book are in project Wakati Gallery :)

.

.

.

Imprint : www.trilo.de/imprint.html