עבור לתוכן
View in the app

A better way to browse. Learn more.

HWzone

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

[PHP] שימוש בarray_search ושמירת מציאת ערך

Featured Replies

פורסם

השתמשתי בarray_search כדי למצוא ערך מסויים ,אני רוצה לשמור את הערך ששמצאתי בתור משתנה

איך אפשר לעשות את זה?:x

פורסם

$return = array_search('test', $arr);
if ($return != false)
$val = $arr[$return];

תיעוד מלא של הפונקציה:

http://php.net/array_search

פורסם
  • מחבר

משומה אני לא מצליח לחפש בפונקציה שיוצרת array

<?php
$links = get_links('[url]http://hwzone.co.il/'[/url]);
function get_links($url) {

// Create a new DOM Document to hold our webpage structure
$xml = new DOMDocument();

// Load the url's contents into the DOM (the @ supresses any errors from invalid XML)
@$xml->loadHTMLFile($url);

// Empty array to hold all links to return
$links = array();

//Loop through each <a> tag in the dom and add it to the link array
foreach($xml->getElementsByTagName('a') as $link) {
$links[] = array('url' => $link->getAttribute('href'), 'text' => $link->nodeValue);
}

//Return the links
return $links;
}
$north = 'index';
if(in_array($north,$links)){
echo 'y';
}else {
echo 'n';
}
"<br />";
//print_r($links);

?>

התוצאה יוצאת שלילית

ואין לי מושג למה:S סורי על נוביות

פורסם

ברור שאתה לא מצליח.

שים לב מה יצרת פה:

$links שהוא מערך בפני עצמו.

ולאחר מכן, בלולאה ב get_links הכנסת ל $links כל פעם שורה נוספת, שהיא בעצמה מערך.

כלומר יש לך מערך שמכיל בתוכו מערכים.

ארכיון

דיון זה הועבר לארכיון ולא ניתן להוסיף בו תגובות חדשות.

דיונים חדשים

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.