Mar 8, 2007

what is more important for a PHP beginner?

once i was a newbie in learing PHP, the funniest things are planning to write some CMS system,some forum programms.now all these seem so ridiculous.How can you fly without wings?so now the answer is that, for those who are really interested in this language,they'd better to learn the basic functions and types,trying to read through the manual ... then read some beautiful and normative code sample , follow sophisticated programmers' guide ... then learn and learn , NEW INTERMEDIATE LEVEL PHP PROGRAMMERs COME OUT!
I will try to do this now!

Mar 7, 2007

PHP Manual, where conceptions and detailed info locate.

there are so many detailed info in the manual,which i almost ignored before. for example, where caculate the member number of an array, we use COUNT( ) or SIZEOF() ;
In the manual, this is described as below:

count

(PHP 3, PHP 4, PHP 5)count -- Count elements in an array, or properties in an object

Descriptionint count ( mixed var [, int mode] )
Returns the number of elements in var, which is typically an
array, since anything else will have one element.
For objects, if you have
SPL installed, you can hook into count() by implementing interface Countable. The interface has exactly one method, count(), which returns the return value for the count() function.
If var is not an array or an object with implemented Countable interface, 1 will be returned. There is one exception, if var is NULL, 0 will be returned.


Note: The optional mode parameter is available as of PHP 4.2.0.
If the optional mode parameter is set to COUNT_RECURSIVE (or 1), count() will recursively count the array. This is particularly useful for counting all the elements of a multidimensional array. The default value for mode is 0. count() does not detect infinite recursion.


SO , COUNT("123") will return int 1.
but in the gameloft test, i choose 'false' ,ft! there is still a long way for me to go...

Mar 6, 2007

PHP written test for Gameloft, NewPostofNewSemester,

More than 30 days passed since last update.
Recently I am learning and preparing some foundational knowledge for programming, something like OOP,data structure and C/C#/Java language etc.


Gameloft PHP test,most of the questions are very basic conceptions and functions,involving PHP array operations,mysql query, and session tricks. for me the most difficult one maybe the bubble arithmetic for number sort.so let's mark it here.

function bubble_sort($array)
{
$count = count($array);
if ($count <= 0) return false; for($i=0; $i<$count; $i++)
{
for($j=$count-1; $j>$i; $j--)
{
if ($array[$j] < $array[$j-1])
{
$tmp = $array[$j];
$array[$j] = $array[$j-1];
$array[$j-1] = $tmp;
}
}
}
return $array;
}

Gameloft is known for the cell phone games.so WAP is also involved in this test. for this part , i did nothing.