Jump to content

Search the Community

Showing results for tags 'arrayphp'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


  • Welcome to PHP Freaks
    • Announcements
    • Introductions
  • PHP Coding
    • PHP Coding Help
    • Regex Help
    • Third Party Scripts
    • FAQ/Code Snippet Repository
  • SQL / Database
    • MySQL Help
    • PostgreSQL
    • Microsoft SQL - MSSQL
    • Other RDBMS and SQL dialects
  • Client Side
    • HTML Help
    • CSS Help
    • Javascript Help
    • Other
  • Applications and Frameworks
    • Applications
    • Frameworks
    • Other Libraries
  • Web Server Administration
    • PHP Installation and Configuration
    • Linux
    • Apache HTTP Server
    • Microsoft IIS
    • Other Web Server Software
  • Other
    • Application Design
    • Other Programming Languages
    • Editor Help (PhpStorm, VS Code, etc)
    • Website Critique
    • Beta Test Your Stuff!
  • Freelance, Contracts, Employment, etc.
    • Services Offered
    • Job Offerings
  • General Discussion
    • PHPFreaks.com Website Feedback
    • Miscellaneous

Find results in...

Find results that contain...

Date Created

  • Start


Last Updated

  • Start


Filter by number of...


  • Start





Website URL








Donation Link

Found 2 results

  1. Hi all, Need help in solving this task using PHP built in function : array_reverse() and without it. Appreciate it in explaining the code as I'm completely a newbie. function reverseArray($Arr) { } $fruits = ["Mango","Strawberry","Bananas","Pineapple"]; $result = reverseArray($fruits); Many thanks,
  2. I'm having trouble comparing two arrays. Ive never worked with arrays like this till today so bare with me. Ill explain as best I can with my code. So I have one array Im pulling from the database. which I get as follows //now get all the tags mysql_select_db($db, $db); $getq = mysql_query("SELECT * FROM blogtags",$db); //create the tags array $arr1 = array(); do{ $arr1[] = $row['tagname']; }while($row = mysql_fetch_assoc($getq)); If I print the outcome of this $arr1 array(3) { [0]=> NULL [1]=> string(4) "cars" [2]=> string(4) "vans" } cars and vans are the only 2 entries in the database Next I have a form field called $_POST['hidden-tags']; which stores data as ....... tanks, bikes, trains here is the code I have to turn that into an array $arr2[] = explode(",",$_POST['hidden-tags']); if I echo that out I get array(1) { [0]=> array(4) { [0]=> string(4) "cars" [1]=> string(5) "bikes" [2]=> string(6) "trains" [3]=> string(5) "tanks" } } which are entries into the form (cars, bikes, trains, tanks) Now Im trying to only show items that are not in the first array with array_diff but for some reason it doesnt work correctly. First I can see in the second array does not look like the first and I dont understand why but im sure thats coursing problems!!!!! secondly If I run the code //show only items in the second array that are not in the first $tmp = array_diff($arr2, $arr1); var_dump($tmp); then this pops out array(1) { [0]=> array(4) { [0]=> string(4) "cars" [1]=> string(5) "bikes" [2]=> string(6) "trains" [3]=> string(5) "tanks" } } surely this should just show bikes, trains, tanks and not the cars as it appears in $arr1
  • 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.