Archive for the ‘Aviv Ronen Articles’ Category:
PHP Casting problem in php4 and php5
PHP Casting problem in php4 and php5
In PHP4, We could CAST a variable like this:
class casttest {
function set_id($id) {
$this-> = $id;
}
}
$test1 = new casttest;echo (int) $test1, “\n”;As you probably guest, in PHP4 the result will be 1 because the variable we printed has a value,
On the other hand, in PHP5 we will receive this error:
Notice: Object of class Country could not be converted to integer in - on line X
And the value we will receive will be 1.
To solve this php version issue, all we have to do is add this:
zend.ze1_compatibility_mode = 1
Good luck,
Aviv.
Php Data Grid - 1
I couldn’t find a good php OS Data Grid Class, so let’s learn how to write one together.
1) The first step will be to create a new folder with the name “arpsdatagrid”
2) Create new file under “arpsdatagrid” folder with the name “arpsdgclass.php”
3) Lets start writing the file
Notes:
1) I’m writing this class with almost no ready made Array functions, just for best understanding of php.
2) There is a reason why i’m using the $dataheaders Array, it’s for future developing of our class.
<?php
class datagrid
{
var $datares; //Array of Data
var $cellsnum; //Size Of $datares
var $dataheaders; //Array of Data Headers
function datagrid($datares,$dataheaders)
{
$this->datares=$datares; //Setting Class Value
$this->cellsnum=sizeof($datares); //Setting Class Value
$this->dataheaders=$dataheaders; //Setting Class Value
return true;
}
function gettable() //Return String that contain table with all the Data
{
$array=$this->datares; //For easy use
$s=”<table border=1><tr>”; //Table Set
for($i=0;$i<sizeof($this->dataheaders);$i++) //get every header
{
$s.=”<td class=\”datagridheadertd\”>”.$this->dataheaders[$i].”</td> \n”;
}
$s.=”</tr>”;
for($i=0;$i<sizeof($array);$i++) //for every value at our Data Array
{
$s.=”<tr>”;
for($x=0;$x<sizeof($this->dataheaders);$x++) //Getting Data Headers
{
$s.=”<td>”.$array[$i][$this->dataheaders[$x]].”</td>”;
}
$s.=”</tr>”;
}
$s.=”</table>”;
return $s;
}
} //Closing the class
?>
How to use it?
Let’s say we have an Array named $array, the array contain
{
$array[0][’FNAME’]=’Aviv’;
$array[0][’LNAME’]=’Ronen’;
$array[1][’FNAME’]=’Aviv2′;
$array[1][’LNAME’]=’Ronen2′;
}
Basically, what we need to do is very simple:
1) $headersarray[0]=’FNAME’; //Setting the headers Array
$headersarray[1]=’LNAME’;
2) $datagrid=new datagrid($array,$headersarray); // Setting a Data Grid.
$tablegrid=$datagrid->gettable(); //Fetching the table string to $tablegrid
echo $tablegrid; //Printing the table string
The result will be:
| FNAME | LNAME |
| Aviv | Ronen |
| Aviv2 | Ronen2 |
Walla!
Enjoy!
Good News - Yahoo! Changes Sponsored Search Minimum Bid Policy
Good News - Yahoo! Changes Sponsored Search Minimum Bid Policy
Yahoo! Announced that minimum bids for a word would no longer be auto fixed to $0.10.
Basically, there is no minimum bid anymore!
But, pleas note - Depending on the keyword relevance, quality, and the number of advertisers that bid, your minimum bids, still might be more expensive.
Yahoo is trying to improve the users in order to compete with Google Adwords.
This is an excellent opportunity to save money in your PPC campaign, I suggest everyone to review theirs campaign and make adjustment for the new changes,
The change is only for the search ads and not for the content ads.
More information:
http://www.netprofitstoday.com/blog/yahoo-changes-sponsored-search-minimum-bid-policy/

