<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>AquilaX's development blog &#187; PHP</title>
	<atom:link href="http://dev.horemag.net/category/php/feed/" rel="self" type="application/rss+xml" />
	<link>http://dev.horemag.net</link>
	<description>code and so on...</description>
	<lastBuildDate>Sun, 25 Apr 2010 07:48:16 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.4</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Mini php based one page RPG game (rp16g)</title>
		<link>http://dev.horemag.net/2010/03/19/mini-php-based-one-page-rpg-game-rp16g/</link>
		<comments>http://dev.horemag.net/2010/03/19/mini-php-based-one-page-rpg-game-rp16g/#comments</comments>
		<pubDate>Fri, 19 Mar 2010 07:29:48 +0000</pubDate>
		<dc:creator>AquilaX</dc:creator>
				<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://dev.horemag.net/?p=111</guid>
		<description><![CDATA[This is my submission for PHASE 2 of the Micro Game Coding Challenge.
rp16g
http://posterfans.com/game/rp16g.php
Size:5.1 KB
Planning and development time ~ 7 hours
rp16g is a small text based rougelike game based on Dragon Slayer. The player (@) must find and kill the dragon (+). The dragon is very strong for the player's initial fitness so some monster killing [...]]]></description>
			<content:encoded><![CDATA[<p>This is my submission for PHASE 2 of the <a href="http://community.bbgamezone.net/index.php/topic,2705.0.html" onclick="javascript:urchinTracker('/outbound/article/http://community.bbgamezone.net/index.php/topic,2705.0.html');">Micro Game Coding Challenge</a>.</p>
<p><strong>rp16g</strong><br />
<a href="http://posterfans.com/game/rp16g.php" onclick="javascript:urchinTracker('/outbound/article/http://posterfans.com/game/rp16g.php');">http://posterfans.com/game/rp16g.php</a><br />
Size:5.1 KB<br />
Planning and development time ~ 7 hours</p>
<p>rp16g is a small text based rougelike game based on Dragon Slayer. The player (@) must find and kill the dragon (+). The dragon is very strong for the player's initial fitness so some monster killing is needed to strengthen the player first.</p>
<p>Game features:<br />
- Game map;<br />
- Fog of war;<br />
- Simple battle system;<br />
- Character stats;<br />
- Romantic end  Grin</p>
<p>The source code of the game is available here: <a href="http://posterfans.com/game/rp16g.php.txt" onclick="javascript:urchinTracker('/outbound/article/http://posterfans.com/game/rp16g.php.txt');">http://posterfans.com/game/rp16g.php.txt</a></p>
]]></content:encoded>
			<wfw:commentRss>http://dev.horemag.net/2010/03/19/mini-php-based-one-page-rpg-game-rp16g/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Small Bulls and cows in PHP</title>
		<link>http://dev.horemag.net/2010/02/22/small-bulls-and-cows-in-php/</link>
		<comments>http://dev.horemag.net/2010/02/22/small-bulls-and-cows-in-php/#comments</comments>
		<pubDate>Mon, 22 Feb 2010 07:38:45 +0000</pubDate>
		<dc:creator>AquilaX</dc:creator>
				<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://dev.horemag.net/?p=108</guid>
		<description><![CDATA[There is competition going on in bbGameZone. I decided to participate with small Bulls and cows game:
Here is my submission "CowsNBulls".
It's a game I loved playing when I was younger.
Demo: http://posterfans.com/game/
Source code: http://posterfans.com/game/index.php.txt (2013 bytes)
The code can be further optimized, but let's leave something for Phase 2 Smiley
Total planning + development + bug fixing time [...]]]></description>
			<content:encoded><![CDATA[<p>There is competition going on in <a href="http://community.bbgamezone.net/index.php/topic,2705.0.html" onclick="javascript:urchinTracker('/outbound/article/http://community.bbgamezone.net/index.php/topic,2705.0.html');">bbGameZone</a>. I decided to participate with small Bulls and cows game:</p>
<p>Here is my submission "CowsNBulls".</p>
<p>It's a game I loved playing when I was younger.</p>
<p>Demo: <a href="http://posterfans.com/game/" onclick="javascript:urchinTracker('/outbound/article/http://posterfans.com/game/');">http://posterfans.com/game/</a><br />
Source code: <a href="http://posterfans.com/game/index.php.txt" onclick="javascript:urchinTracker('/outbound/article/http://posterfans.com/game/index.php.txt');">http://posterfans.com/game/index.php.txt</a> (2013 bytes)</p>
<p>The code can be further optimized, but let's leave something for Phase 2 Smiley<br />
Total planning + development + bug fixing time about 1 hour.</p>
]]></content:encoded>
			<wfw:commentRss>http://dev.horemag.net/2010/02/22/small-bulls-and-cows-in-php/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Get parameters in Code Igniter</title>
		<link>http://dev.horemag.net/2009/05/29/get-parameters-in-code-igniter/</link>
		<comments>http://dev.horemag.net/2009/05/29/get-parameters-in-code-igniter/#comments</comments>
		<pubDate>Fri, 29 May 2009 04:19:22 +0000</pubDate>
		<dc:creator>AquilaX</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[code_igniter]]></category>
		<category><![CDATA[get]]></category>
		<category><![CDATA[request]]></category>

		<guid isPermaLink="false">http://dev.horemag.net/?p=96</guid>
		<description><![CDATA[If you want to use GET parameters in Code igniter just for specific controller do use the following line in your Controller's constructor:
&#160;
    parse_str&#40;$_SERVER&#91;'QUERY_STRING'&#93;,$_GET&#41;;
&#160;
Also make sure to call your script like this (even if you use mod_rewrite to get rid of index.php):
www.example.com/index.php/controller/method/?par1=1&#038;par2=2
]]></description>
			<content:encoded><![CDATA[<p>If you want to use GET parameters in Code igniter just for specific controller do use the following line in your Controller's constructor:</p>
<pre class="php">&nbsp;
    <a href="http://www.php.net/parse_str" onclick="javascript:urchinTracker('/outbound/article/http://www.php.net/parse_str');"><span style="color: #000066;">parse_str</span></a><span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$_SERVER</span><span style="color: #66cc66;">&#91;</span><span style="color: #ff0000;">'QUERY_STRING'</span><span style="color: #66cc66;">&#93;</span>,<span style="color: #0000ff;">$_GET</span><span style="color: #66cc66;">&#41;</span>;
&nbsp;</pre>
<p>Also make sure to call your script like this (even if you use mod_rewrite to get rid of index.php):</p>
<p>www.example.com/<strong>index.php</strong>/controller/method/?par1=1&par2=2</p>
]]></content:encoded>
			<wfw:commentRss>http://dev.horemag.net/2009/05/29/get-parameters-in-code-igniter/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Media Wiki Bot</title>
		<link>http://dev.horemag.net/2009/03/24/media-wiki-bot/</link>
		<comments>http://dev.horemag.net/2009/03/24/media-wiki-bot/#comments</comments>
		<pubDate>Tue, 24 Mar 2009 06:11:15 +0000</pubDate>
		<dc:creator>AquilaX</dc:creator>
				<category><![CDATA[/dev/null]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[bot]]></category>
		<category><![CDATA[media wiki]]></category>
		<category><![CDATA[wiki]]></category>

		<guid isPermaLink="false">http://dev.horemag.net/?p=86</guid>
		<description><![CDATA[I needed a bot to quickly modify the pages of wiki.muonlinehelp.com. So I created Mutex which kind of helps do the job. It's full of bugs with no error handling but works for me.
Usage:
&#160;
&#60;?
  require 'class.mediawiki.php';
  $mw = new mediawiki&#40;'http://yourwikiurl/api.php'&#41;;
  $mw-&#62;login&#40;'bot_user', 'bot_password'&#41;;
  $mw-&#62;editPage&#40;'title', 'page_text'&#41;;
?&#62;
&#160;
You can get the source code from here. [...]]]></description>
			<content:encoded><![CDATA[<p>I needed a bot to quickly modify the pages of <a href="http://wiki.muonlinehelp.com" onclick="javascript:urchinTracker('/outbound/article/http://wiki.muonlinehelp.com');">wiki.muonlinehelp.com</a>. So I created <a href="http://wiki.muonlinehelp.com/index.php?title=User:Mutex" onclick="javascript:urchinTracker('/outbound/article/http://wiki.muonlinehelp.com/index.php?title=User:Mutex');">Mutex</a> which kind of helps do the job. It's full of bugs with no error handling but works for me.</p>
<p>Usage:</p>
<pre class="php">&nbsp;
<span style="color: #000000; font-weight: bold;">&lt;?</span>
  <span style="color: #b1b100;">require</span> <span style="color: #ff0000;">'class.mediawiki.php'</span>;
  <span style="color: #0000ff;">$mw</span> = <span style="color: #000000; font-weight: bold;">new</span> mediawiki<span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">'http://yourwikiurl/api.php'</span><span style="color: #66cc66;">&#41;</span>;
  <span style="color: #0000ff;">$mw</span>-&gt;<span style="color: #006600;">login</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">'bot_user'</span>, <span style="color: #ff0000;">'bot_password'</span><span style="color: #66cc66;">&#41;</span>;
  <span style="color: #0000ff;">$mw</span>-&gt;<span style="color: #006600;">editPage</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">'title'</span>, <span style="color: #ff0000;">'page_text'</span><span style="color: #66cc66;">&#41;</span>;
<span style="color: #000000; font-weight: bold;">?&gt;</span>
&nbsp;</pre>
<p>You can get the source code from <a href="http://wiki.muonlinehelp.com/index.php?title=User:Mutex" onclick="javascript:urchinTracker('/outbound/article/http://wiki.muonlinehelp.com/index.php?title=User:Mutex');">here</a>. </p>
]]></content:encoded>
			<wfw:commentRss>http://dev.horemag.net/2009/03/24/media-wiki-bot/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Akismet problems</title>
		<link>http://dev.horemag.net/2008/03/16/akismet-problems/</link>
		<comments>http://dev.horemag.net/2008/03/16/akismet-problems/#comments</comments>
		<pubDate>Sun, 16 Mar 2008 10:21:20 +0000</pubDate>
		<dc:creator>AquilaX</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[aksimet]]></category>

		<guid isPermaLink="false">http://dev.horemag.net/2008/03/16/akismet-problems/</guid>
		<description><![CDATA[I use Aksimet for comment filtering in two of my projects, scenata.com and diggbg.com. It's very useful anti spam solution and worked like a charm .. until recently when it started to break the encoding on some of the comments. Fortunately the problem is easy to solve and the solution can be found here.
]]></description>
			<content:encoded><![CDATA[<p>I use <a href="http://akismet.com/" onclick="javascript:urchinTracker('/outbound/article/http://akismet.com/');">Aksimet</a> for comment filtering in two of my projects, <a href="http://scenata.com" onclick="javascript:urchinTracker('/outbound/article/http://scenata.com');">scenata.com</a> and <a href="http://diggbg.com" onclick="javascript:urchinTracker('/outbound/article/http://diggbg.com');">diggbg.com</a>. It's very useful anti spam solution and worked like a charm .. until recently when it started to break the encoding on some of the comments. Fortunately the problem is easy to solve and the solution can be found <a href="http://blog.akismet.com/2008/02/25/using-http-11/" onclick="javascript:urchinTracker('/outbound/article/http://blog.akismet.com/2008/02/25/using-http-11/');">here</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://dev.horemag.net/2008/03/16/akismet-problems/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Perlin noise generator in PHP</title>
		<link>http://dev.horemag.net/2008/03/02/perlin-noise-generator-in-php/</link>
		<comments>http://dev.horemag.net/2008/03/02/perlin-noise-generator-in-php/#comments</comments>
		<pubDate>Sun, 02 Mar 2008 10:56:17 +0000</pubDate>
		<dc:creator>AquilaX</dc:creator>
				<category><![CDATA[Math]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[perlin noise]]></category>
		<category><![CDATA[SVG]]></category>
		<category><![CDATA[terrain]]></category>

		<guid isPermaLink="false">http://dev.horemag.net/2008/03/02/perlin-noise-generator-in-php/</guid>
		<description><![CDATA[Generating Perlin noise requires heavy calculation and PHP (in my opinion) is not the best language for this task but still it can be useful.
The algorithm is an adaptation form this pseudo code.
The class seems to work but I'm not if it works 100% correctly. The tricky part was to deal with the types because [...]]]></description>
			<content:encoded><![CDATA[<p><img src='http://dev.horemag.net/wp-content/uploads/noise.gif' alt='Perlin noise' style="float:left; margin-right:5px;"/>Generating <a href="http://en.wikipedia.org/wiki/Perlin_noise" onclick="javascript:urchinTracker('/outbound/article/http://en.wikipedia.org/wiki/Perlin_noise');">Perlin noise</a> requires heavy calculation and PHP (in my opinion) is not the best language for this task but still it can be useful.<br />
The algorithm is an adaptation form <a href="http://freespace.virgin.net/hugo.elias/models/m_perlin.htm" onclick="javascript:urchinTracker('/outbound/article/http://freespace.virgin.net/hugo.elias/models/m_perlin.htm');">this</a> pseudo code.<br />
The class seems to work but I'm not if it works 100% correctly. The tricky part was to deal with the types because PHP tends to convert large integers to float, and the algorithm uses bitwise operators on some stages. </p>
<p>This class is just for testing purposes it consumes a lot of CPU cycles and I hardly recommend to avoid using it in live environment. Try to keep the cycles low as well as the octaves number close to 1. </p>
<p>Sample SVG result: <a class="html" href='http://dev.horemag.net/wp-content/uploads/noise.svg' title='noise.svg'>noise.svg</a>.<br />
Example usage (generate SVG map of terrain): </p>
<pre class="php">&nbsp;
  <span style="color: #b1b100;">require</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;class.perlin.php&quot;</span><span style="color: #66cc66;">&#41;</span>;
  <span style="color: #0000ff;">$per</span> = <span style="color: #000000; font-weight: bold;">new</span> Perlin;
&nbsp;
  <span style="color: #0000ff;">$xl</span> = <span style="color: #cc66cc;">100</span>;
  <span style="color: #0000ff;">$yl</span> = <span style="color: #cc66cc;">40</span>;
&nbsp;
  <a href="http://www.php.net/header" onclick="javascript:urchinTracker('/outbound/article/http://www.php.net/header');"><span style="color: #000066;">header</span></a><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;Content-type: image/svg+xml&quot;</span><span style="color: #66cc66;">&#41;</span>;
  <a href="http://www.php.net/echo" onclick="javascript:urchinTracker('/outbound/article/http://www.php.net/echo');"><span style="color: #000066;">echo</span></a> <span style="color: #ff0000;">'&lt;?xml version=&quot;1.0&quot; standalone=&quot;no&quot;?&gt;'</span>;
  <a href="http://www.php.net/echo" onclick="javascript:urchinTracker('/outbound/article/http://www.php.net/echo');"><span style="color: #000066;">echo</span></a> <span style="color: #ff0000;">'&lt;!DOCTYPE svg PUBLIC &quot;-//W3C//DTD SVG 1.1//EN&quot;
  &quot;http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd&quot;&gt;'</span>;
  <a href="http://www.php.net/echo" onclick="javascript:urchinTracker('/outbound/article/http://www.php.net/echo');"><span style="color: #000066;">echo</span></a> <span style="color: #ff0000;">'&lt;svg width=&quot;400&quot; height=&quot;400&quot;
  xmlns=&quot;http://www.w3.org/2000/svg&quot; version=&quot;1.1&quot;&gt;'</span>;
  <span style="color: #0000ff;">$size</span> = <span style="color: #cc66cc;">3</span>;
  <span style="color: #b1b100;">for</span> <span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$x</span> = <span style="color: #cc66cc;">0</span>; <span style="color: #0000ff;">$x</span> &lt; <span style="color: #0000ff;">$xl</span>; <span style="color: #0000ff;">$x</span>++<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#123;</span>
    <span style="color: #b1b100;">for</span> <span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$y</span> = <span style="color: #cc66cc;">0</span>; <span style="color: #0000ff;">$y</span> &lt; <span style="color: #0000ff;">$yl</span>; <span style="color: #0000ff;">$y</span>++<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#123;</span>
      <span style="color: #0000ff;">$n</span> = <span style="color: #0000ff;">$per</span>-&gt;<span style="color: #006600;">perlinNoise2d</span><span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$x</span>, <span style="color: #0000ff;">$y</span><span style="color: #66cc66;">&#41;</span>*<span style="color: #cc66cc;">255</span>;
      <span style="color: #0000ff;">$c</span> = <span style="color: #ff0000;">'#986121'</span>;
      <span style="color: #b1b100;">if</span> <span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$n</span> &lt; <span style="color: #cc66cc;">50</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#123;</span>
        <span style="color: #0000ff;">$c</span> = <span style="color: #ff0000;">'#0000ff'</span>;
      <span style="color: #66cc66;">&#125;</span>
      <span style="color: #b1b100;">if</span> <span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$n</span> &gt; <span style="color: #cc66cc;">200</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#123;</span>
        <span style="color: #0000ff;">$c</span> = <span style="color: #ff0000;">'#FFFFFF'</span>;
      <span style="color: #66cc66;">&#125;</span>
      <a href="http://www.php.net/echo" onclick="javascript:urchinTracker('/outbound/article/http://www.php.net/echo');"><span style="color: #000066;">echo</span></a> <span style="color: #ff0000;">&quot;&lt;rect x=<span style="color: #000099; font-weight: bold;">\&quot;</span>&quot;</span>.<span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$x</span>*<span style="color: #0000ff;">$size</span><span style="color: #66cc66;">&#41;</span>.<span style="color: #ff0000;">&quot;<span style="color: #000099; font-weight: bold;">\&quot;</span> y=<span style="color: #000099; font-weight: bold;">\&quot;</span>&quot;</span>.<span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$y</span>*<span style="color: #0000ff;">$size</span><span style="color: #66cc66;">&#41;</span>.<span style="color: #ff0000;">&quot;<span style="color: #000099; font-weight: bold;">\&quot;</span>
            width=<span style="color: #000099; font-weight: bold;">\&quot;</span>$size<span style="color: #000099; font-weight: bold;">\&quot;</span> height=<span style="color: #000099; font-weight: bold;">\&quot;</span>$size<span style="color: #000099; font-weight: bold;">\&quot;</span> fill=<span style="color: #000099; font-weight: bold;">\&quot;</span>$c<span style="color: #000099; font-weight: bold;">\&quot;</span>/&gt;<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span>;
    <span style="color: #66cc66;">&#125;</span>
  <span style="color: #66cc66;">&#125;</span>
  <a href="http://www.php.net/echo" onclick="javascript:urchinTracker('/outbound/article/http://www.php.net/echo');"><span style="color: #000066;">echo</span></a> <span style="color: #ff0000;">'&lt;/svg&gt;'</span>;
&nbsp;</pre>
<p>Download: <a class="zip" href='http://dev.horemag.net/wp-content/uploads/classperlinphp.zip' title='classperlinphp.zip'>classperlinphp.zip</a></p>
]]></content:encoded>
			<wfw:commentRss>http://dev.horemag.net/2008/03/02/perlin-noise-generator-in-php/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
		<item>
		<title>PHP Maze Generator class</title>
		<link>http://dev.horemag.net/2008/03/01/php-maze-generation-class/</link>
		<comments>http://dev.horemag.net/2008/03/01/php-maze-generation-class/#comments</comments>
		<pubDate>Sat, 01 Mar 2008 15:01:04 +0000</pubDate>
		<dc:creator>AquilaX</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[algorithm]]></category>
		<category><![CDATA[class]]></category>
		<category><![CDATA[code]]></category>
		<category><![CDATA[maze]]></category>
		<category><![CDATA[SVG]]></category>

		<guid isPermaLink="false">http://dev.horemag.net/2008/03/01/php-maze-generation-class/</guid>
		<description><![CDATA[I looked for PHP maze generation algorithms today and couldn't find anything. Fortunately Wikipedia has an article on Maze generation algorithm with source code written in Java. The easiest part was to transfer the code to PHP (it looks like PHP supports the same bitwise operators' syntax as Java), and the hardest to make it [...]]]></description>
			<content:encoded><![CDATA[<p><img src='http://dev.horemag.net/wp-content/uploads/maze.gif' alt='Maze' style="float:left; margin-right:5px"/>I looked for PHP maze generation algorithms today and couldn't find anything. Fortunately <a href="http://en.wikipedia.org" onclick="javascript:urchinTracker('/outbound/article/http://en.wikipedia.org');">Wikipedia</a> has an article on <a href="http://en.wikipedia.org/wiki/Maze_generation_algorithm" onclick="javascript:urchinTracker('/outbound/article/http://en.wikipedia.org/wiki/Maze_generation_algorithm');">Maze generation algorithm</a> with <a href="http://en.wikipedia.org/wiki/Image:Maze.png" onclick="javascript:urchinTracker('/outbound/article/http://en.wikipedia.org/wiki/Image:Maze.png');">source code</a> written in Java. The easiest part was to transfer the code to PHP (it looks like PHP supports the same bitwise operators' syntax as Java), and the hardest to make it work properly (the problem was at the rendering stage). More information on mazes and ways to generate them, can be found <a href="http://www.astrolog.org/labyrnth/algrithm.htm" onclick="javascript:urchinTracker('/outbound/article/http://www.astrolog.org/labyrnth/algrithm.htm');">here</a>. </p>
<p>See the class in action as HTML output <a href="http://dev.horemag.net/wp-content/uploads/maze.php" >here</a><br />
and  as SVG output <a href='http://dev.horemag.net/wp-content/uploads/svg.php' title='svg.php'>here</a></p>
<p>Example usage for the class:</p>
<pre class="php">&nbsp;
  <span style="color: #b1b100;">require</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">'class.maze.php'</span><span style="color: #66cc66;">&#41;</span>;
  <span style="color: #0000ff;">$maze</span> = <span style="color: #000000; font-weight: bold;">new</span> Maze<span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">40</span>, <span style="color: #cc66cc;">40</span><span style="color: #66cc66;">&#41;</span>;
  <a href="http://www.php.net/echo" onclick="javascript:urchinTracker('/outbound/article/http://www.php.net/echo');"><span style="color: #000066;">echo</span></a> <span style="color: #0000ff;">$maze</span>-&gt;<span style="color: #006600;">getStyle</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
  <a href="http://www.php.net/echo" onclick="javascript:urchinTracker('/outbound/article/http://www.php.net/echo');"><span style="color: #000066;">echo</span></a> <span style="color: #0000ff;">$maze</span>-&gt;<span style="color: #006600;">render</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
&nbsp;</pre>
<p><strong>Update:</strong> (01.03.2008) version 1.1.0 now supports SVG output</p>
<p>Download:<a class="zip" href='http://dev.horemag.net/wp-content/uploads/classmazephp.zip' title='classmazephp.zip'>classmazephp.zip</a></p>
]]></content:encoded>
			<wfw:commentRss>http://dev.horemag.net/2008/03/01/php-maze-generation-class/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Callback function to class in PHP</title>
		<link>http://dev.horemag.net/2007/11/25/callback-function-to-class-in-php/</link>
		<comments>http://dev.horemag.net/2007/11/25/callback-function-to-class-in-php/#comments</comments>
		<pubDate>Sun, 25 Nov 2007 11:20:36 +0000</pubDate>
		<dc:creator>AquilaX</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[callback]]></category>
		<category><![CDATA[OOP]]></category>

		<guid isPermaLink="false">http://dev.horemag.net/2007/11/25/callback-function-to-class-in-php/</guid>
		<description><![CDATA[A short sample on how to attach a callback function to PHP class:
&#160;
&#60;?php
&#160;
  function outside&#40;&#38;$p1, $p2&#41;&#123;
    $p1 = &#34;This comes from the outside&#34;;
    echo &#34;Outside: $p2\n&#34;;
  &#125;
&#160;
  class test&#123;
    var $_events = array&#40;&#41;;
&#160;
    function attach&#40;$handler_name, $method_name&#41; &#123;
    [...]]]></description>
			<content:encoded><![CDATA[<p>A short sample on how to attach a callback function to <a href="http://php.net" onclick="javascript:urchinTracker('/outbound/article/http://php.net');">PHP</a> class:</p>
<pre class="php">&nbsp;
<span style="color: #000000; font-weight: bold;">&lt;?php</span>
&nbsp;
  <span style="color: #000000; font-weight: bold;">function</span> outside<span style="color: #66cc66;">&#40;</span>&amp;<span style="color: #0000ff;">$p1</span>, <span style="color: #0000ff;">$p2</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#123;</span>
    <span style="color: #0000ff;">$p1</span> = <span style="color: #ff0000;">&quot;This comes from the outside&quot;</span>;
    <a href="http://www.php.net/echo" onclick="javascript:urchinTracker('/outbound/article/http://www.php.net/echo');"><span style="color: #000066;">echo</span></a> <span style="color: #ff0000;">&quot;Outside: $p2<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span>;
  <span style="color: #66cc66;">&#125;</span>
&nbsp;
  <span style="color: #000000; font-weight: bold;">class</span> test<span style="color: #66cc66;">&#123;</span>
    <span style="color: #000000; font-weight: bold;">var</span> <span style="color: #0000ff;">$_events</span> = <a href="http://www.php.net/array" onclick="javascript:urchinTracker('/outbound/article/http://www.php.net/array');"><span style="color: #000066;">array</span></a><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
&nbsp;
    <span style="color: #000000; font-weight: bold;">function</span> attach<span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$handler_name</span>, <span style="color: #0000ff;">$method_name</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span>
      <span style="color: #0000ff;">$this</span>-&gt;_events<span style="color: #66cc66;">&#91;</span><span style="color: #0000ff;">$handler_name</span><span style="color: #66cc66;">&#93;</span> = <span style="color: #0000ff;">$method_name</span>;
    <span style="color: #66cc66;">&#125;</span>
&nbsp;
    <span style="color: #000000; font-weight: bold;">function</span> execute<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#123;</span>
      <span style="color: #0000ff;">$ename</span> = <span style="color: #ff0000;">'event1'</span>;
      <span style="color: #0000ff;">$intext</span> = <span style="color: #ff0000;">'This comes from the inside'</span>;
      <span style="color: #0000ff;">$outtext</span> = <span style="color: #ff0000;">''</span>;
      <span style="color: #b1b100;">if</span> <span style="color: #66cc66;">&#40;</span><a href="http://www.php.net/isset" onclick="javascript:urchinTracker('/outbound/article/http://www.php.net/isset');"><span style="color: #000066;">isset</span></a><span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$this</span>-&gt;_events<span style="color: #66cc66;">&#91;</span><span style="color: #0000ff;">$ename</span><span style="color: #66cc66;">&#93;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#123;</span>
        <a href="http://www.php.net/call_user_func" onclick="javascript:urchinTracker('/outbound/article/http://www.php.net/call_user_func');"><span style="color: #000066;">call_user_func</span></a><span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$this</span>-&gt;_events<span style="color: #66cc66;">&#91;</span><span style="color: #0000ff;">$ename</span><span style="color: #66cc66;">&#93;</span>, &amp;<span style="color: #0000ff;">$outtext</span>, <span style="color: #0000ff;">$intext</span><span style="color: #66cc66;">&#41;</span>;
      <span style="color: #66cc66;">&#125;</span>
      <a href="http://www.php.net/echo" onclick="javascript:urchinTracker('/outbound/article/http://www.php.net/echo');"><span style="color: #000066;">echo</span></a> <span style="color: #ff0000;">&quot;test Class: $outtext<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span>;
    <span style="color: #66cc66;">&#125;</span>
  <span style="color: #66cc66;">&#125;</span>
&nbsp;
  <span style="color: #0000ff;">$test</span> = <span style="color: #000000; font-weight: bold;">new</span> test<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
&nbsp;
  <span style="color: #0000ff;">$test</span>-&gt;<span style="color: #006600;">attach</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">'event1'</span>, <span style="color: #ff0000;">'outside'</span><span style="color: #66cc66;">&#41;</span>;
  <span style="color: #0000ff;">$test</span>-&gt;<span style="color: #006600;">execute</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
&nbsp;
<span style="color: #000000; font-weight: bold;">?&gt;</span>
&nbsp;</pre>
<p>This script produces the following result:</p>
<pre>
Outside: This Comes from the inside
test Class: This comes from the outside
</pre>
]]></content:encoded>
			<wfw:commentRss>http://dev.horemag.net/2007/11/25/callback-function-to-class-in-php/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Oracle with PHP5 on Linux</title>
		<link>http://dev.horemag.net/2007/11/21/oracle-with-php5-on-linux/</link>
		<comments>http://dev.horemag.net/2007/11/21/oracle-with-php5-on-linux/#comments</comments>
		<pubDate>Wed, 21 Nov 2007 12:24:24 +0000</pubDate>
		<dc:creator>AquilaX</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[oracle]]></category>
		<category><![CDATA[php5]]></category>

		<guid isPermaLink="false">http://dev.horemag.net/2007/11/21/oracle-with-php5-on-linux/</guid>
		<description><![CDATA[Very nice and useful tutorial on how to run Oracle with PHP5 support on Linux (Debian) can be found on http://remorse.nl/weblog/debian_oracle_xe_and_php5/
Note Also be sure to set the NLS_LANG environment variable to the www-data user.
]]></description>
			<content:encoded><![CDATA[<p>Very nice and useful tutorial on how to run Oracle with PHP5 support on Linux (Debian) can be found on <a href="http://remorse.nl/weblog/debian_oracle_xe_and_php5/" onclick="javascript:urchinTracker('/outbound/article/http://remorse.nl/weblog/debian_oracle_xe_and_php5/');">http://remorse.nl/weblog/debian_oracle_xe_and_php5/</a></p>
<p><strong>Note</strong> Also be sure to set the NLS_LANG environment variable to the www-data user.</p>
]]></content:encoded>
			<wfw:commentRss>http://dev.horemag.net/2007/11/21/oracle-with-php5-on-linux/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>phpMyAdmin change session expire time</title>
		<link>http://dev.horemag.net/2007/11/20/phpmyadmin-change-session-expire-time/</link>
		<comments>http://dev.horemag.net/2007/11/20/phpmyadmin-change-session-expire-time/#comments</comments>
		<pubDate>Tue, 20 Nov 2007 09:17:37 +0000</pubDate>
		<dc:creator>AquilaX</dc:creator>
				<category><![CDATA[MySql]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[phpmyadmin]]></category>

		<guid isPermaLink="false">http://dev.horemag.net/2007/11/20/phpmyadmin-change-session-expire-time/</guid>
		<description><![CDATA[To change phpMyAdmin's default session expire time (1800 s), change the 'LoginCookieValidity' setting to whatever value of seconds You like.
From the phpMyAdmin's wiki's Config page.
LoginCookieValidity
Define how long (in seconds) a login cookie is valid.
$cfg['LoginCookieValidity'] = 1800;
Maximum value is 2^31-1 , which is around 2.1 * 10^9. This is about 58 years.
If you are on a [...]]]></description>
			<content:encoded><![CDATA[<p>To change <a href="http://www.phpmyadmin.net" onclick="javascript:urchinTracker('/outbound/article/http://www.phpmyadmin.net');">phpMyAdmin</a>'s default session expire time (1800 s), change the 'LoginCookieValidity' setting to whatever value of seconds You like.<br />
From the phpMyAdmin's wiki's <a href="http://wiki.cihar.com/pma/Config" onclick="javascript:urchinTracker('/outbound/article/http://wiki.cihar.com/pma/Config');">Config page</a>.</p>
<blockquote><p><strong>LoginCookieValidity</strong><br />
Define how long (in seconds) a login cookie is valid.</p>
<pre>$cfg['LoginCookieValidity'] = 1800;</pre>
<p>Maximum value is 2^31-1 , which is around 2.1 * 10^9. This is about 58 years.<br />
If you are on a 64-bit system it is even longer. 2^63-1. Longer than the age of the universe.
</p></blockquote>
]]></content:encoded>
			<wfw:commentRss>http://dev.horemag.net/2007/11/20/phpmyadmin-change-session-expire-time/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
