strposa

Example: strposa ( string $haystack, array $needle [, int $offset = 0 ] )

This function searches a string for every element/value found in an array and returns the position of the first element/value found in the string. In technical terms, it searches for mutilple needles in a haystack and returns the position of the first occurance found in the string. Note: this function is case sensitive.

[php]

/**
* strposa ( string $haystack, array $needle [, int $offset = 0 ] )
*
* @param string $haystack
* @param mixed $needles – should be an array, but can be any
* string, int, or array
* @param integer $offset
* @return the position of the first items found in the array
*
* Original contibutions by:
* ==============================
* - Leonardo Martinez ( http://www.leonardomartinez.com/contact/ )
* - vbracco at gmail dot com
* - nathan at bitmesh dot com
* - dpharris at llu dot edu
*
* Description:
* ========================
* – searches for mutilple needles in a haystack and returns
* the position of the first occurance, case-sensitive.
* – finds the position of the first occurrence of array (needles)
* in the haystack string, case-sensitive.
* – if you are looking for more than one needle in the haystack,
* this function will replace php’s strpos()
* – if you searching for the position of a single value, it is
* recommended that you use strpos().
*
*
* Notes:
* ====================================
* below are several functions that search for the position of a needle)
* —————————————————————————
* strpos() - Returns the position of the first occurrence of a needle
* in the haystack string, case-sensitive.
* stripos() - Returns the position of the first occurrence of a needle
* in the haystack string, case-insensitive.
* strrpos() - Returns the position of the last occurrence of needle in
* the haystack string, case-sensitive. Note that the needle
* in this case can only be a single character in PHP 4. If a
* string is passed as the needle, then only the first character
* of that string will be used.
* strripos() - Returns the position of the last occurrence of needle in the
* haystack string, case-insensitive.
*
*/

function strposa( $haystack, $needles, $offset=0 ){

if (!is_array( $needles )) $needles = array( $needles );

$result = array();
foreach( $needles as $needle ){
if ( strpos( $haystack, $needle, $offset) !== false ) {
$result[] = strpos( $haystack, $needle, $offset);
}
}

if( empty( $result )) return false;

return min( $result );

}

$haystack = ‘How much wood would a woodchuck chuck if a woodchuck could chuck wood’;
$needles = array(‘woodchuck’, ‘wood’, ‘could’, ‘chuck’);

$string = strposa( $haystack, $needles );
print_r($string);

/**
* the result will be 9,
* it found the word ‘wood’ first on the 9th element of the haystack.
* remember that it’s really the 10th item on the list, but php starts with 0 (zero).
*/

[/php]

eileenseitz.com, Miami, Florida (October 2009)
Webstie Development (CMS, WordPress, PHP, MySQL)

  • Eileen Seitz, Inc. is a website for one of Florida’s best know artist. This website is a revision of our original PHP/MySQL database/shoppingcart developed in 2006. It offers a customzied shopping cart and blog through wordpress.
  • The website was developed using WordPress as an API, and a cusomized shopping cart. Customers can logon to this website, complete their purchases using SSL, and provide feedback to the artist. The artist can also enter manage her shopping cart by adding new artwork and information into her shopping cart, alert customers of new art show schedules, update her biography and manage her blog from an administrative section in the program

Two Dimensional Array Key Swap in PHP

Example: array[key1][key2] → array[key2][key1]

This function takes a two dimensional array[x][y], swaps the first key with the second key so the values can be referenced using array[y][x]. It was also added as a user contributed note to the PHP: Array Manual on php.net’s website on October 10, 2009.

[php]
#

function array_two_key_swap( $two_dimensional_array ) {

/*
Writen by: Leonardo Martinez
Contact: http://www.leonardomartinez.com/contact/

Created: 10-10-2009
Modified: 10-15-2009

This function takes a two dimensional array[x][y], swaps the first
key with the second key so the values can be referenced using array[y][x].

Example:
samplearray['directiory'][0] = "myicons";
samplearray['directiory'][1] = "myicons";
samplearray['directiory'][2] = "myiconsold";
samplearray['directiory'][3] = "myiconsold";

samplearray['filename'][0] = "hat.png";
samplearray['filename'][1] = "dog.png";
samplearray['filename'][2] = "mice.png";
samplearray['filename'][3] = "rat.png";

The above array converts to:

newarray[0]['filename'] = "hat.png";
newarray[0]['directiory'] = "myicons";
newarray[1]['filename'] = "dog.png";
newarray[1]['directiory'] = "myicons";
newarray[2]['filename'] = "mice.png";
newarray[2]['directiory'] = "myiconsold";
newarray[3]['filename'] = "rat.png";
newarray[3]['directiory'] = "myiconsold";

*/

$keys = array_keys( $two_dimensional_array );

$array_swaped = array();

foreach( $two_dimensional_array[$keys[0]] as $key_counter => $value1 ) {

$temp_array = array();

foreach( $keys as $key) {
$temp_array[$key] = $two_dimensional_array[$key][$key_counter];
}

$array_swaped[] = $temp_array;
}

return $array_swaped;
}
[/php]

Thumbnail Gallery

This thumbnail gallery is provided to you for personal use. It was compiled for use with an API/Framework plugin I created called, “Simple Wordpress Framework”. It contains both 16 x 16 and 32 x 32 pixel images @ 32 bit colors. You can download a zip file with the complete collection, including the index.html, and php file that generates the webpage by clicking on the link below. I will try to add more icons every month.

Click here to download the zip file: Download

Tango Icon Theme 0.8.90

These icons were obtained by freedesktop.org an opensource solution for icons.

32, 16 Pixels (16bit Black/White)

Tango Icons

Corporate, Operating System, Application and Other Misc. Icons

These icons were obtained from applications that reside on the desktop computer.

32, 16 Pixels (16bit Black/White)

Other Icons

Angela Toro ( Photographer ), Miami, Florida (September 2009)
Webstie Development ( WordPress, PHP, mySQL, JavaScript and Flash )

  • Angela Toro is an independent professional photographer from Colombia, she currently lives in Miami, Florida.
  • The website was custom designed with WordPress and SlideshowPro, and SlideShowPro Director.

searchvacationrental.com, Miami, Florida (July 2009)
Webstie Development (Joomla, PHP, MySQL)

  • Search Vacation Rental is an online vacation rental website. It allows rental owners and management companies the ability to showcase their vacation rental property on the web.
  • This website took approximately 1 year to develop by using a combination of open-source applications, including Joomla, FunsionMaps, Light-box, Google Maps, Google Analytics  and AEC Backup.
  • Allows for comprehensive backend management for both the Administrators and Property Owners.  The administrator has the ability manage subscriptions and offer different plans to it’s subscribers. Each plan can control the cost, subscription period, and time that it will be available.  The owners have the ablity to change all aspects of their listed property.
  • Provides automated credit card processing, and customer email notifications.
  • The program has several unique features, including dynamic image resizing/caching, a sidebar that changes dynamically providing the renter the ability to narrow their search by selecting specific property features, and advanced search option, and the ability to allow the owner to upload an unlimited number of photos.

FireBugz (Since 2008)
Skill Level: Advanced

  • FireBugz is a simple debugging tool in FireFox that allows a user to quickly locate programming problems in HTML, CSS and JavaScript.
  • I am able to debug JavaScript code using its internal debugger and locate inconsistencies with CSS/HTML elements.

Art By Martin ( Professional Artist ), Miami, Florida (February 2008)
Webstie Development ( WordPress, PHP, mySQL, JavaScript and Flash )

  • Mariana Martin is an independent professional artist who lives in Miami, Florida.
  • The website was designed with a custom made shopping cart, blog and slideshow.

Onda Films, Miami, FL (February 2008)
Webstie Development (Flash & XML)

  • Onda Films is an international production company that has created effective, imaginative spots for some of the most influential advertisers in the Central, South America, and the United States.
  • The website is a combination of Flash, Flash Video.
  • Client can add and change the website content by using XML

Easy Website for Artist., Miami, Florida (October 2008 – Current)
Project is currently in Development (Demo will be provided upon request)
Webstie Development (PHP, mySQL, JavaScript and Flash)

  • Easy Website for Artists is company that envisioned the development of a specilized web-application that is specific to artists.  Currently several artists have been added Art By Martin, Eileen Seitz, ImaginArt, Angela Toro, and others which may have been added in the last 6 months.
  • The website was designed with a combination of techniologes, primarily mySQL, PHP, Flash and XML, and offeres an integrated blog, flash slideshow, and custom shopping cart.
  • The website was created to allow the client and artists to make changes to their website, thus eliminating the need of a web designer. 
  • It also allows the adaptation of new websites within 1 to 4 hrs. It includes an integraded blog, slideshow, shopping cart, artshow schedule, biography, and more.
  • The website took five months to develop and has an incredible amount of custom programming in php and mySQL. Of all my projects this has been one of my favorite.
  • Please go to the website to check out some of the sample websites created by the web-application.
  • Opening May 1st, 2008.