3v4l.org

run code in 300+ PHP versions simultaneously
<?php //this code shows friend suggestions. //******************************************************************************** // // User Id wgaira ka code dekh lena, is script me use krne k liye. OK. $user_id set honi chahye! // //******************************************************************************** // select all users in table: tbluser $searchq = "SELECT * FROM tbluser WHERE user_id <> '$user_id' LIMIT 5"; // it will show 4/5 suggestions. change to whatever you want $searchresult = mysql_query($searchq) or die(mysql_error()); while($row_user = mysql_fetch_array($searchresult)){ // check if user is friend or not $fon="SELECT * FROM friends WHERE (user_id = '$user_id') OR (friend_id = '$user_id')"; $result = mysql_query($fon) or die(mysql_error()); $row = mysql_num_rows($result); // if user is not in friend list i.e $row=0 if ($row == 0) { $uid = $row_user['id']; $user_photo = $row_user['photo']; $fullname = $row_user['fname'].' '.$row_user['lname']; // you can change the link to add friend $add_friend_link = '<a style="font-size: small;" href="add_friend.php?fid='.$uid.'">Add as friend</a>'; //you can change this html to suit your needs $html = '<img src="'.$user_photo.'" align="absmiddle" alt="'.$fullname.'" title="'.$fullname.'"></img>'.$fullname.'<br/>'.$add_friend_link.' <br/><br/>'; //show the html code(friend suggestions) echo $html; //if user is in friend list, following code will show next friend suggestion } else { continue; } } ?>
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 47) Position 1 = 9, Position 2 = 13
Branch analysis from position: 9
1 jumps found. (Code = 79) Position 1 = -2
Branch analysis from position: 13
1 jumps found. (Code = 42) Position 1 = 61
Branch analysis from position: 61
2 jumps found. (Code = 44) Position 1 = 66, Position 2 = 14
Branch analysis from position: 66
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 14
2 jumps found. (Code = 47) Position 1 = 25, Position 2 = 29
Branch analysis from position: 25
1 jumps found. (Code = 79) Position 1 = -2
Branch analysis from position: 29
2 jumps found. (Code = 43) Position 1 = 35, Position 2 = 60
Branch analysis from position: 35
1 jumps found. (Code = 42) Position 1 = 61
Branch analysis from position: 61
Branch analysis from position: 60
1 jumps found. (Code = 42) Position 1 = 61
Branch analysis from position: 61
filename:       /in/9lNXG
function name:  (null)
number of ops:  67
compiled vars:  !0 = $searchq, !1 = $user_id, !2 = $searchresult, !3 = $fon, !4 = $result, !5 = $row, !6 = $uid, !7 = $row_user, !8 = $user_photo, !9 = $fullname, !10 = $add_friend_link, !11 = $html
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   12     0  E >   ROPE_INIT                                     3  ~13     'SELECT+%2A+FROM+tbluser+WHERE+user_id+%3C%3E+%27'
          1        ROPE_ADD                                      1  ~13     ~13, !1
          2        ROPE_END                                      2  ~12     ~13, '%27+LIMIT+5'
          3        ASSIGN                                                   !0, ~12
   14     4        INIT_FCALL_BY_NAME                                       'mysql_query'
          5        SEND_VAR_EX                                              !0
          6        DO_FCALL                                      0  $16     
          7        ASSIGN                                           ~17     !2, $16
          8      > JMPNZ_EX                                         ~17     ~17, ->13
          9    >   INIT_FCALL_BY_NAME                                       'mysql_error'
         10        DO_FCALL                                      0  $18     
         11      > EXIT                                                     $18
         12*       BOOL                                             ~17     <true>
   16    13    > > JMP                                                      ->61
   18    14    >   ROPE_INIT                                     5  ~20     'SELECT+%2A+FROM+friends+WHERE+%28user_id+%3D+%27'
         15        ROPE_ADD                                      1  ~20     ~20, !1
         16        ROPE_ADD                                      2  ~20     ~20, '%27%29+OR+%28friend_id+%3D+%27'
         17        ROPE_ADD                                      3  ~20     ~20, !1
         18        ROPE_END                                      4  ~19     ~20, '%27%29'
         19        ASSIGN                                                   !3, ~19
   20    20        INIT_FCALL_BY_NAME                                       'mysql_query'
         21        SEND_VAR_EX                                              !3
         22        DO_FCALL                                      0  $24     
         23        ASSIGN                                           ~25     !4, $24
         24      > JMPNZ_EX                                         ~25     ~25, ->29
         25    >   INIT_FCALL_BY_NAME                                       'mysql_error'
         26        DO_FCALL                                      0  $26     
         27      > EXIT                                                     $26
         28*       BOOL                                             ~25     <true>
   22    29    >   INIT_FCALL_BY_NAME                                       'mysql_num_rows'
         30        SEND_VAR_EX                                              !4
         31        DO_FCALL                                      0  $27     
         32        ASSIGN                                                   !5, $27
   24    33        IS_EQUAL                                                 !5, 0
         34      > JMPZ                                                     ~29, ->60
   25    35    >   FETCH_DIM_R                                      ~30     !7, 'id'
         36        ASSIGN                                                   !6, ~30
   26    37        FETCH_DIM_R                                      ~32     !7, 'photo'
         38        ASSIGN                                                   !8, ~32
   27    39        FETCH_DIM_R                                      ~34     !7, 'fname'
         40        CONCAT                                           ~35     ~34, '+'
         41        FETCH_DIM_R                                      ~36     !7, 'lname'
         42        CONCAT                                           ~37     ~35, ~36
         43        ASSIGN                                                   !9, ~37
   29    44        CONCAT                                           ~39     '%3Ca+style%3D%22font-size%3A+small%3B%22+href%3D%22add_friend.php%3Ffid%3D', !6
         45        CONCAT                                           ~40     ~39, '%22%3EAdd+as+friend%3C%2Fa%3E'
         46        ASSIGN                                                   !10, ~40
   31    47        CONCAT                                           ~42     '%3Cimg+src%3D%22', !8
         48        CONCAT                                           ~43     ~42, '%22+align%3D%22absmiddle%22+alt%3D%22'
         49        CONCAT                                           ~44     ~43, !9
         50        CONCAT                                           ~45     ~44, '%22+title%3D%22'
         51        CONCAT                                           ~46     ~45, !9
         52        CONCAT                                           ~47     ~46, '%22%3E%3C%2Fimg%3E'
         53        CONCAT                                           ~48     ~47, !9
         54        CONCAT                                           ~49     ~48, '%3Cbr%2F%3E'
         55        CONCAT                                           ~50     ~49, !10
         56        CONCAT                                           ~51     ~50, '+%3Cbr%2F%3E%3Cbr%2F%3E'
         57        ASSIGN                                                   !11, ~51
   33    58        ECHO                                                     !11
         59      > JMP                                                      ->61
   36    60    > > JMP                                                      ->61
   16    61    >   INIT_FCALL_BY_NAME                                       'mysql_fetch_array'
         62        SEND_VAR_EX                                              !2
         63        DO_FCALL                                      0  $53     
         64        ASSIGN                                           ~54     !7, $53
         65      > JMPNZ                                                    ~54, ->14
   40    66    > > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
153.52 ms | 1399 KiB | 13 Q