Created
April 3, 2020 04:01
-
-
Save phpfiddle/31c2fa96bad2320230b908ac91b3e6ac to your computer and use it in GitHub Desktop.
[ Posted by Sgoehre ] testtesttedst
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$mitarbeiter = ["Bob","Peter","Lisa"]; | |
function ersetzen($array, $wert, $wert_neu) { | |
if(in_array($wert,$array)) { | |
$index = array_search($wert, $array); | |
$array[$index] = $wert_neu; | |
echo "Der Wert $wert an der Stelle / mit dem Index $index ist in dem Array enthalten und wurde mit $wert_neu ersetzt";} | |
} | |
ersetzen($mitarbeiter, "Bob", "Alexa"); | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment