3v4l.org

run code in 300+ PHP versions simultaneously
<?php $str1 = "CN=CMPPDepartemental_Secretariat,OU=1 - Groupes de sécurité,OU=CMPP,OU=Pole,OU=Utilisateurs,DC=ricky,DC=fr"; $str2 = "CN=CMPPDepartemental_Direction,OU=1 - Groupes de sécurité,OU=CMPP,OU=Pole,OU=Utilisateurs,DC=ricky,DC=fr"; var_dump(find_by_keyword($str2, "CN=")); function find_by_keyword( $string, $keyword ) { $array = explode(",",$string); $found = []; // Loop through each item and check for a match. foreach ( $array as $string ) { // If found somewhere inside the string, add. if ( strpos( $string, $keyword ) !== false ) { $found[] = substr($string, strlen($keyword)); } } return $found; }
Output for git.master, git.master_jit, rfc.property-hooks
array(1) { [0]=> string(27) "CMPPDepartemental_Direction" }

This tab shows result from various feature-branches currently under review by the php developers. Contact me to have additional branches featured.

Active branches

Archived branches

Once feature-branches are merged or declined, they are no longer available. Their functionality (when merged) can be viewed from the main output page


preferences:
104.83 ms | 405 KiB | 5 Q