Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7075623
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T06:11:59+00:00 2026-05-28T06:11:59+00:00

I use codeigniter.I want search in site contents for several word, that did existence

  • 0

I use codeigniter.I want search in site contents for several word, that did existence it word in it site or no? if existence a word (of all words) in it site return is FALSE. i tried as following code but get error. How can done it?

DEMO: http://codepad.viper-7.com/rFiL01

<?php
        $ch = curl_init();
        curl_setopt($ch, CURLOPT_URL,'stackoverflow.com');
        curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
        $contents = curl_exec($ch);
        curl_close($ch);
        $link[] = array("Questions", "Favorite", "myfoodho");
                foreach($link as $val){
                    stristr($contents,$val); // Line 148
                    //if(){
                    //      return true;
                    //}else{
                    //    return false;
                    //}
                }
?>

Error:

A PHP Error was encountered

Severity: Warning

Message: stristr() [function.stristr]: needle is not a string or an
integer

Filename: views/exchange.php

Line Number: 148

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-28T06:11:59+00:00Added an answer on May 28, 2026 at 6:11 am

    When you write

    $link[] = array("Questions", "Favorite", "myfoodho");
    

    you are creating an array that contains another array, that is:

    array(
        0 => array(
            "Questions", 
            "Favorite",
            "myfoodho"
        )
    )
    

    In the foreach loop you’re just going through the outer array and therefore $val contains the inner array, not the string values.

    The solution is to remove the brackets and just assign the array to the variable.

    $link = array("Questions", "Favorite", "myfoodho");
    

    Debugging tip: The error message says “needle is not a string or an integer”. The “needle” of that function is the second parameter (check the docs if you’re not sure). You can then add var_dump( $val ) right before that line to check what the value actually is, if it’s not a string or an integer.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am using CodeIgniter with version 2.1.0. I want to use Hooks for login
I'm running a LAMP environment with CodeIgniter. I want to be able to use
I use auto CodeIgniter 2.1 + Auto Crumb helper that I get from here
in codeigniter you can use wildcard to reroute. i never heard the word wildcards
I use codeigniter and want check if exists a url in content other url,
I'm starting to learn how to use CodeIgniter, and I want to create static
I am creating a social site and for search want to try solr or
I now use codeigniter and I want to add or delete records according to
I use CodeIgniter 2.1.0, i want after insert data in database get a message
I use CodeIgniter 2.1.0, i store data session in database ci_sessions , i want

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.