Jump to content

Recommended Posts

<?php
// Assuming the above tags are at www.example.com
$tags = get_meta_tags('http://www.example.com/');

// Notice how the keys are all lowercase now, and
// how . was replaced by _ in the key.
echo $tags['author'];       // name
echo $tags['keywords'];     // php documentation
echo $tags['description'];  // a php manual
echo $tags['geo_position']; // 49.33;-86.59
?>

By remove do you mean not display them if it's empty or what? You can use empty to determine if it's empty or not. We really need a better explanation & relevant code to help, you just posted an example from the manual.

Sorry Alex.

 

What's happening is that in some instances with the code below I'm receiving:

 

string(0) ""

 

I've tried to dump it and unset it however now it still echo's "NULL"

 

 

[php
<?php
$tags = get_meta_tags('http://www.example.com/');

$data = explode(",", $tags['keywords']);

foreach ($data as $value)
if (empty($value)){
unset($value);
var_dump($value);
} else {
echo $value . "<br />" . PHP_EOL;
flush();
    ob_flush();
    usleep(500000);
}
}

?>[/code]

 

 

You want to remove it from the array?

 

foreach ($data as $key => $value) 
   if (empty($value)){
      unset($data[$key]);
      var_dump($value);
   } else { 
...

 

var_dump will return NULL because it's... null.

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.