<?php
$numbers = range(0, 9);
foreach($numbers as $value)
echo $value." ";
//Will output 0 1 2 3 4 5 6 7 8 9
?>
<?php
$numbers = range(0, 9);
foreach($numbers as $value)
echo $value." ";
//Will output 0 1 2 3 4 5 6 7 8 9
?>
<?php
$testData= array('Test1', 'Test2', 'Test3');
print_r(array_reverse($testData));
//Array ( [0] => Test3 [1] => Test2 [2] => Test1 )
?>
<?php
$testData= array('Test1', 'Test2', 'Test3');
echo end($testData); // Test3
?>
<?php
// Example 1
$testValues = "test1 test2 test3 test4 test5";
$testArray = explode(" ", $testValues);
print_r($testArray);
//Array ( [0] => test1 [1] => test2 [2] => test3 [3] => test4 [4] => test5 )
// Example 2
$testValues = "test1,test2,test3,test4,test5";
$testArray = explode(",", $testValues);
print_r($testArray);
//Array ( [0] => test1 [1] => test2 [2] => test3 [3] => test4 [4] => test5 )
?>
<?php
$testArray = array('Test1', 'Test2', 'Test3');
$testString = implode(",", $testArray);
echo $testString; // Test1,Test2,Test3
?>
<?php
$testArray = array('Test1', 'Test2', '');
print_r( array_filter($testArray));
// Array ( [0] => Test1 [1] => Test2 )
?>
<?php
$testArray = array('Test1', 'Test2', 'Test1');
echo( count($testArray)); // 3
echo( sizeof($testArray)); // 3
?>
<?php
echo $length = strlen("Efforts"); // 7
?>
<?php
global $wpdb;
$querystr = " SELECT distinct(post_title) ,ID,post_title FROM $wpdb->posts
WHERE post_type='post' AND post_status='publish' ";
$pageposts = $wpdb->get_results($querystr, OBJECT);
?>
Zend | Magento Certified PHP | eCommerce Architect